mardi 1 mai 2018

Laravel - SQL Query with relational multiple rows

I have a query that gets the officiants credentials, although that can return many rows if the user has any.

I am trying to get a query where IF one of the rows renew column is set to 1 then ignore it, else, return the results if its still 0

$officiants = Officiant::where('status', 1)
            ->whereHas('cred',function($q) {
                $q->where('renewal', 0);
            })
            ->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire