Answer the question
In order to leave comments, you need to log in
How to make a whereIn query if the array is empty?
have a request
Rosid::
whereIn('user_id',$users_id)
->WhereIn('status_id',$statuses)
->get();
Answer the question
In order to leave comments, you need to log in
$query = new Rosid();
if(count($users_id)){
$query = $query->whereIn('user_id',$users_id);
}
if(count($statuses)){
$query = $query->WhereIn('status_id',$statuses);
}
$query->get();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question