Vote count:
0
Is there any way to use closure for where
in join clause in Eloquent?
What I'm trying to do is:
$model = $model->leftJoin('history', function ($join) {
$join->on('history.record_id', '=', 'work_order.work_order_id');
$join->where('history.tablename', '=', 'test');
$join->where('history.columnname', '=', 'column');
$join->where(function ($q) {
$q->where('history.value_from', '=', '0')
->orWhere('history.value_from', '=', '');
});
$join->where('history.value_to', '>', '0');
});
but obviously the part:
$join->where(function ($q) {
$q->where('history.value_from', '=', '0')
->orWhere('history.value_from', '=', '');
});
doesn't work because JoinClause
doesn't support closure for where
asked 19 secs ago
Eloquent Join - where closure
Aucun commentaire:
Enregistrer un commentaire