My laravel eloquent is like this :
$products = Product::where(\'status\', 1)
->where(\'stock\', \'>\', 0)
->where(\'category
What I did as a workaround and to prevent further security issues I make it happen like this:
public function getLatestModels (){
\DB::statement("SET SQL_MODE=''");
$latestInserted = Glasses::with('store.deliveryType','glassesHasTags','glassesHasColors','glassesHasSizes','glassesHasImages','glassesBrand','glassesMaterial')->whereRaw("store_id in (select distinct store_id from glasses)")->groupBy('store_id')->orderBy('created_at')->take(8)->get();
\DB::statement("SET SQL_MODE=only_full_group_by");
return $latestInserted;
}
this is a kind of combination of other answers. Also if you are using "use Illuminate\Support\Facades\DB;" you don't need backslashes in those DB statements above.
The only disadvantage here is that we are making three calls to db :(
p.s. As I see @Felipe Pena answer I guess the second statement is unnecessary