dollar dollar - 2 months ago 24
PHP Question

how to write >= eloquent database query in laravel 5.2

I am trying to fire eloquent query in laravel 5.2

Movies_showtimes::with('showdata','movie','cinema')->where(['cinema_id'=>$id,'show_date'=>Carbon::today()])->get();


This query fetches all movie showtimes for today date only. I want to fetch the movie showtimes for >= today but I am unable to fit >= symbol in where() clause in above query.

Help is appreciated. I tried doing like this but it didn't worked for me

Movies_showtimes::with('showdata','movie','cinema')->where(['cinema_id'=>$id,'show_date','>=',Carbon::today()])->get();

Answer

Try this query

Movies_showtimes::with('showdata','movie','cinema')->where(
    [['cinema_id','=',$id],['show_date','>=',Carbon::today()]]
    )->get();
Comments