Does the library create relations based on primary keys only or any indexes?? #43
Answered
by
MGatner
kipchirchirian
asked this question in
Q&A
|
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?? |
Answered by
MGatner
Nov 2, 2022
Replies: 1 comment 3 replies
|
This library uses the schema generated by |
3 replies
Answer selected by
kipchirchirian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.