Open jlopez0313 opened 4 years ago
Hi there, we want to write that for us all work fine in mysql with package cross-database.
In this query User are in DB1 and categories are in DB2. the result work great!
For us, we must specify relation connection ('database.relation') in :
And for User, we must replace Authenticatable with new model class:
Thanks for the trick :+1:
Having trouble with mine on SQL Server, the generated query looks like this
(SQL: select top 1 from [Clients] where exists (select from [TMACentral-Demo].[Cli_Core] where [Clients].[CLIENTNUM] = [Cli_Core].[SYSID])
When it should be [TMACentral-Demo].[dbo].[Cli_Core]
Is that possible to use Laravel CDS in two different schemas?
I have 2 connections in .env and database.php, but in whereHas it only use the main DB.. p.e. Users is located in schema 1 from DB A Posts is located in schema 2 from DB B
I have set the connection in both models and this works fine:
$query = \App\Users->with('Posts')->get();
But this code doesn't work fine:
$query = \App\Users->with('Posts')->whereHas('Posts', function($q) { $q->where('post_type', '3');})->get();
Description:
Steps To Reproduce: