I have the following Parent - Child table structure ....
Parent
Child
The relationship is Parent HasOne/HasMany Child linked on Parent.child_id-->Child.parent_id
BREAD Relationships assume that the relationship is Parent.child_id -> Child.id
See relationship.blade.php, Line 48 ....
@php
$relationshipData = (isset($data)) ? $data : $dataTypeContent;
$model = app($options->model);
$query = $model::where($options->column, '=', $relationshipData->id)->first();
@endphp
But this is not always true.
Need some method to select an alternative child id
Same issue for me.
谋 change manually
$query = $model::where($options->column, '=', $relationshipData->id)->first();
To
$query = $model::where($options->column, '=', $relationshipData->{$options->key})->first();
But this is not best solution.
I tested the same change and it does work :) , but really, this is just as inflexible as the current functionality.
IMO The Relationship configuration needs an additional parameter for the child table field_id.
This will likely not be fixed for 1.0.*
We're working on rebuilding the entire bread editor from scratch, so it'll function completely differently. I haven't decided whether that'll find it's way into 1.1, 1.2, or 2.0 yet
For us, this is a critical function. We would like to add Voyager to several existing third party apps, but there's no possibility that the database structure can be changed.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
For us, this is a critical function. We would like to add Voyager to several existing third party apps, but there's no possibility that the database structure can be changed.