vendredi 4 décembre 2020

Validate Date in Laravel

I have this booking table

start_date | end_date

2020-12-15   2020-12-18
2020-12-19   2020-12-22

In this table booking data is getting saved, but i want to validate date before saving data, if start date and end date is between the database date then that record should not get saved.

I'm using this query :

$query = Booking::where('start_date', '>=', $request->start_date)->where('end_date','<=',$request->end_date)->get();

Any help is highly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire