Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to create query whereIn OR whereIn in Laravel 5

by
Category:laravel
mysql laravel
How to create query whereIn OR whereIn in Laravel 5

You can build your query step-by-step and then call get() method. But sometimes it gets a little tricky for more complicated queries – for example, if you have multiple whereIn OR whereIn conditions and you want to put brackets, do it like this.

$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();

0 Comments


Html code work in comment box


Related Post