Laravel Multiple Where Condition Query Example
In this quick laravel eloquent tips tutorial i will explain how we can use laravel where multiple columns query. Sometimes we need to make multiple where condition in laravel. If you don't know how to use aravel eloquent multiple where conditions, the this tutorial is for you.
Almost, we need to write multiple where condition with laravel. as we know we can use where clause using where() in laravel. but if you want to write multiple where clause in laravel then you can write multiple where conditions in two ways. I will show you simple multiple where clause in laravel.
$product = Product::where([ [ 'category_id', '=', $request->category_id ], [ 'id', '=', $request->product_id ] ])->first();
So the condition you have to write like that
->where([ ['COLUMN_NAME', 'OPERATOR', 'VALUE'], ['COLUMN_NAME', 'OPERATOR', 'VALUE'] ]);
Hope it can help you.