Create a new custom validation rule class and in the passes method, check if a Salary already exists between the given dates.
https://laravel.com/docs/8.x/validation#custom-validation-rules
Nov 28, 2022
8
Level 1
How to validate date in Laravel?
Hello Sir, I want to add validation to dates in laravel 8. Actually, I am generating a salary for workers but If the salary is already created and the admin tries to create the salary between already created dates then I want to show him the message Please select different dates or something else.
Suppose the salary between 1-10-2022 to 1-15-2022 is already created then I don't want to create another salary between these dates.
I tried to do myself but no idea had come into my mind.
public function createForHamal(Request $request)
{
$result = SalaryMaster::whereBetween//
}
Please or to participate in this conversation.