Laravel compare dates

xJoeyv posted 1 year ago


I ran into a issue with laravel I want to 'compare' dates.
This to creatae a appointment, but how to? I want to make sure the Date + Time is not in use, the values are stored in the database under Start and End date.

But how can I check if the there is already a ongoing or planned appoint on the time the user want to create a appointment?

I want to write this in validator or something close to it.

astroanu replied 1 year ago

your dates are stored in the db so you need to check with mysql,

use BETWEEN in mysql

in laravel qloquent it's whereBetween($colName, $start, $end)

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us