vendredi 20 mai 2022

query inside with eloquent

image address has location and total number of users.

    Users::with(['address'=>function($query){
    $query->where('location', 'NAXAL');
    $query->order By('total');
    }])->get();

this query will return all the users and on relation whose query did not match will be null .I want to pull only those users which do not null value on relation and order By accordingly.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire