Laravel compare dates


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.

  • 3 months 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)