Closed gepopp closed 1 year ago
Laravel Version: 9.52
Nova Version: 4.22.2
Database Driver & Version: mySql 8.2.4
Not sure if this is really Nova issue or if this belongs to eloquent, ive got a BelongsToMany Relation between a PressAgency Model and the User Model setup like so:
BelongsToMany::make( 'Nutzer', 'users', 'App\Nova\User' ) ->fields( function ( $request, $relatedModel ) { return [ Text::make( 'Role' ), Boolean::make( 'owner' )->default( false ), ]; } )->searchable() ->dontReorderAttachables() ->allowDuplicateRelations(),
If i remove the "allowDuplicateRelations" function it throws a mySql error when searching for users, the query looks like:
select * fromuserswhere not exists (selectpress_agency_idfrompressagency_userwherepressagency_user.press_agency_id= 1 and press_agencies.id =pressagency_user.press_agency_id) andusers.idin (1, 3728, 3222, 2576) order byupdated_atasc
select * from
where not exists (select
from
where
.
= 1 and press_agencies.id =
) and
in (1, 3728, 3222, 2576) order by
asc
and the error:
As far as i found out in mySql 8 you cannot reference outer tables in a subquery?
Any Idea how to solve this?
i had an err in the relation setup....
Laravel Version: 9.52
Nova Version: 4.22.2
Database Driver & Version: mySql 8.2.4
Description:
Not sure if this is really Nova issue or if this belongs to eloquent, ive got a BelongsToMany Relation between a PressAgency Model and the User Model setup like so:
If i remove the "allowDuplicateRelations" function it throws a mySql error when searching for users, the query looks like:
select * from
userswhere not exists (select
press_agency_idfrom
pressagency_userwhere
pressagency_user.
press_agency_id= 1 and press_agencies.id =
pressagency_user.
press_agency_id) and
users.
idin (1, 3728, 3222, 2576) order by
updated_atasc
and the error:
1054 - Unknown Tabel Column 'press_agencies.id' in where clause
As far as i found out in mySql 8 you cannot reference outer tables in a subquery?
Any Idea how to solve this?
Detailed steps to reproduce the issue on a fresh Nova installation: