Hi,
I am beginner in Laravel. I make my project in Laravel 6.
I have this code:
public function validation(Request $request)
{
if ($this->endDate < now()->toDateString() or $this->summaryPeopleLimit <= $this->peopleLimit + 1) {
return json_encode(['status' => 'error', 'message' => 'Rejestracja na to wydarzenie została zakończona!']);
}
if ($this->calcutateAge($request->input('date')) <= 18) {
return json_encode(['status' => 'error', 'message' => 'Jesteś osobą niepełnoletnią. Rejestracja dozwolona jest dla użytkowników pełnoletnich!']);
}
if ($this->reservationRepository->isFreeReservationForEmail( $request->input('email'),$request->input('date') )) {
return json_encode(['status' => 'error', 'message' => 'Posiadasz już rezerwację na to wydarzenie!']);
}
return json_encode(['status' => 'ok']);
}
I need add this function:
1.Check if the date format: $ request-> input ('date') is correct (is it not, for example: 9999-99-99),
2. Check that the date in $ request-> input ('date') is not in the future