Thursday, April 13, 2017

How to use multiple OR,AND condition in Laravel queries

I need help for query in laravel

My Custom Query: (Return Correct Result)

Select * FROM events WHERE status = 0 AND (type="public" or type = "private")

how to write this query in Laravel.

Event::where('status' , 0)->where("type" , "private")->orWhere('type' , "public")->get();

But it's returning all public events that status is not 0 as well.

I am using Laravel 5.4



via M Arfan

Advertisement