Does the library create relations based on primary keys only or any indexes?? #43
-
I have two tables: Employees:
Skills:
Note:
I have been using this library for some time but not with the tables built like this i.e. the PK is not the referenced key. Now, $employee = $employeeModel->with(['skills'])->where('employee_id', 'def456')->find(); does not work and always returns an empty array. I have tried playing around with the Is there a way to set the key to use for relations?? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This library uses the schema generated by |
Beta Was this translation helpful? Give feedback.
This library uses the schema generated by
Tatter\Schemas
, which I believe uses any index available. If you head over to that repo you could check the code; there are also instructions on how to identify related tables using a manually-provided schema.