samedi 5 décembre 2020

where not working with whereBetween in Laravel

I have this booking table

start_date | end_date | status

2020-12-15   2020-12-18    Active
2020-12-19   2020-12-22    Inactive

In this table booking data is getting saved,but i want to add where also with whereBetween to return those rows where status is Active. I have used below query but it is returning Inactive rows also.

 $available_start = date('Y-m-d', strtotime($request->start_date));
         $available_end = date('Y-m-d', strtotime($request->end_date));     
         $checkData =Booking::whereBetween('start_date', [
            $available_start, $available_end
        ])->orwhereBetween('end_date', [
            $available_start, $available_end
        ])->where('status','Active')->get();      

Any help is highly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire