Answer the question
In order to leave comments, you need to log in
How to correctly compose a SQL query using Eloquent?
Tell me how to make a selection with the OR condition using Eloquent.
At the output, you need this query
select * from tableName where (event_id=50 and event_date > NOW()) or (event_id=50 and event_status=7451)
$schedulers = Schedule::with('status')->where('event_id', $eventId)->orWhere() ???;
Answer the question
In order to leave comments, you need to log in
$shedulers = Shedule::where(function($query) use($eventId){
$query->where('event_id', $eventId)
->where('event_date', '>', 'NOW()')
})
->orWhere(function($query) use($eventId){
$query->where('event_id', $eventId)
->where('event_status', 7451);
})
->get();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question