Validation for overlapping date/time fields
Hello! I've got a
It also does error when editing an existing entry even tho it only "overlaps" with itself.
TimeLog resource which is for users to clock in and clock out. How do I make sure that the clock_in and clock_out timestamps are not overlapping with any other entry in the database for that user? I've got a validation rule right now that I'm applying to both of the timestamp fields, but I don't like how messy it is and was wondering if there's a better way:It also does error when editing an existing entry even tho it only "overlaps" with itself.
Solution
I'd use a customv aldiation rule, also see:
https://laracasts.com/discuss/channels/filament/rule-in-filamentphp
https://laracasts.com/discuss/channels/filament/rule-in-filamentphp
Laracasts