Closed aiimon22 closed 6 years ago
I followed the steps from the youtube video. Please help!
To solve the above problem, follow the steps: 1 - Access the "company" table in your database and enter any record. Example: id = 1; Name = Company XYZ 2 - In the Controller "store" method: "EmployeeManagementControlle.php", change the line below $ Input ['company_id'] = 0; for this $ Input ['company_id'] = 1; // where 1 is equal to "id" of the record inserted in step 1
Of course! You can solve the above question by implementing a "tinker" or "seed" to populate the table.
Fixed it
(2/2) QueryException SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
callcentre
.employees
, CONSTRAINTemployees_company_id_foreign
FOREIGN KEY (company_id
) REFERENCEScompany
(id
)) (SQL: insert intoemployees
(lastname
,firstname
,middlename
,address
,city_id
,state_id
,country_id
,zip
,age
,birthdate
,date_hired
,department_id
,division_id
,picture
,company_id
,updated_at
,created_at
) values (Aiman, Ahmed, Aiman, Izzudheen Magu, 20329, M. Rankoralige, 1, 1, 1, 20329, 29, 1990/03/01, 2017/07/24, 1, 1, avatars/JdzVGpL3M6G2bJFq9GY35xsyOsmYmjlf0OhilvQY.jpeg, 0, 2017-07-01 16:00:37, 2017-07-01 16:00:37))