so i have model A who is using local database connection, and model B that is using remote database.
i am using laravel with filament and i have created a many to many relationship between model A and model B,i was able to get all Model B values on when creating a new model A value but when i save i get the error that the pivot table is not available on the remote connection.
the SQL query would be something like this
select
model B
.*,
pivot
.model A
as pivot_modelA_id
,
pivot
.model B
as pivot_modelB_id
from
model A
inner join pivot
on model B
.id
= pivot
.ModelB_id
where
pivot
.Model A
= 1
and the query is running on the remote connection.
i have tried to edit the relationship between model A and B by using setconnection to local before belongstomany, but it didn't work.
is there a solution for this issue where i tell laravel to get the data from the pivot table first then search for it on the remote database instead.