WHERE (a = 1 OR b = 2) AND (c = 3 OR d = 4);
<?php MODELNAME::where(function($a) { $a->where('a', 1)->orWhere('b', 2); })->where(function($a) { $a->where('c', 3)->orWhere('d', 4); });
How to Display the RAW SQL
To display the raw SQL you can write the above code within the query log like below.
<?php // Enable query log \DB::enableQueryLog(); MODELNAME::where(function($a) { $a->where('a', 1)->orWhere('b', 2); })->where(function($a) { $a->where('c', 3)->orWhere('d', 4); }); // Show results of log dd(DB::getQueryLog());
Leave a reply