You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I call the powerjoinfunction: joinRelationshipUsingAlias, with only the name of the relation as a parameter
Powerjoin creates the following query:
inner join `lookupables` as `31816ced6e12347e02dbcd4865c7f779` on `31816ced6e12347e02dbcd4865c7f779`.`lookupable_id` = `attributen`.`id`
inner join `lookups` as `52c1d48dd796b76bfe00982d5469c0d5` on `52c1d48dd796b76bfe00982d5469c0d5`.`id` = `31816ced6e12347e02dbcd4865c7f779`.`lookup_id`
and `52c1d48dd796b76bfe00982d5469c0d5`.`deleted_at` is null
and `lookupables`.`lookupable_type` = ? and `52c1d48dd796b76bfe00982d5469c0d5`.`type` = ?
As you can see. the lookupable_type is not using the alias.
Kind Regards
Jurjen
The text was updated successfully, but these errors were encountered:
Also When providing the alias manually, this is not working properly
->leftJoinRelationshipUsingAlias($field['foreignKey']['relation'], [
'lookups' => function ($join) use($lookupAlias) {
$join->as($lookupAlias);
},
'lookupables' => function ($join) use($lookupableAlias) {
$join->as($lookupableAlias); }
]);
Result:
LEFT JOIN `lookupables` AS `attributen_is_sleutelveld_lookupables` ON `lookupables`.`lookupable_id` = `attributen`.`id`
LEFT JOIN `lookups` AS `attributen_is_sleutelveld_lookups` ON `attributen_is_sleutelveld_lookups`.`id` = `lookupables`.`lookup_id`
Hello,
I join the table attributes with a MoprhMany to lookups with lookupables. In attributes I create the relation in this way
return $this->morphToMany(Lookup::class, 'lookupable')->where('lookups.type', 'attribuut_datatype');
I call the powerjoinfunction: joinRelationshipUsingAlias, with only the name of the relation as a parameter
Powerjoin creates the following query:
As you can see. the lookupable_type is not using the alias.
Kind Regards
Jurjen
The text was updated successfully, but these errors were encountered: