YouTube Icon

Code Playground.

How to create query whereIn OR whereIn in Laravel 5

CFG

How to create query whereIn OR whereIn in Laravel 5

You will build step-by-step your query and then name the process get). But sometimes, for more complex questions, it gets a little tricky – for example, if you have several In OR WhereIn Conditions and want to insert brackets, do so. 

$getrecord = DiamondMaster::where('is_delete','0')->where('user_id',Auth::user()->id);
if(!empty($request->stone_id))
{
	$postdata = $request->stone_id;
	$certi_id =trim($postdata,",");
	$getrecord = $getrecord->whereIn('id',explode(",", $certi_id))
						   ->orWhereIn('Certi_NO',explode(",", $certi_id));		
}
$getrecord = $getrecord->get();




CFG