I have a query that needs to check multiple orWhere statements.
$cases = ['john', 'kate', 'mike', 'rob', 'josh', 'moe']
I want to use where as a for loop in this case.
Cat::where(function($q) use ($cases) {
$q->where('name', 'john')->orWhere('name', 'kate'); // etc
})->get();
Is there a cleaner way to use this with a for loop so it chains orWhere on the fly?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire