If I have something like the following, how can I add a left join to the "with(new Model)" part?
Model::whereIn('name', function ($query) use ($link) {
$query->select('name')
->from(with(new Model)->getTable()) // would like to do a leftJoin here
->where('link', $link);
})->get();
I've tried
Model::whereIn('name', function ($query) use ($link) {
$query->select('name')
->from(with(new Model)->leftJoin('tableZ', Model.col1, '=', tableZ.col1)->getTable())
->where('link', $link);
})->get();
I've also tried:
Model::whereIn('name', function ($query) use ($link) {
$query->select('name')
->from(with(new Model)->getTable())
->leftJoin('tableZ', Model.col1, '=', tableZ.col1)
->where('link', $link);
})->get();
Not exactly sure how I'm supposed to go about doing this.