Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

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();
Last updated 2 years ago.
0

Awesome! It turns out whereIn was what I was looking for.

Thanks!

Last updated 2 years ago.
0

One day you'll offer me a nuka cola.

Last updated 2 years ago.
0

Perhaps even a quantum

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.