If you're trying to create something like:
where('page', $arg1)->orWhere('page', $arg2)->...->orWhere('page', $argN);
You should use whereIn:
whereIn('page', $args);
But be careful, because where in throw an exception if $args is empty.
If you want to really use where(cond1) and where(cond2) and ... where(condN) you could build the query using a foreach:
$qb = DB::table("content");
foreach($args as $arg){
$qb->where('page', $arg);
}
return $qb->get();
Awesome! It turns out whereIn was what I was looking for.
Thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community