How can I add in conditional the value of the query i'm using on when function of eloquent laravel?
Here's what I want to happen
$user = User::when('logged' == '3', function ($q){
$q->where('role', 'admin');
)}->get();
As you can see I want to get the role admin only when the column logged
is equal to 3 how can I do this one ? thank you.
P.S.
just an example query. thank you.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire