vendredi 12 juin 2020

Laravel validation enddate after start date not working

i am trying to validate that the end date must be after the start date but its not working if i put the end date before the start date it pass without showing the error message here's my code

my view

<input id="start_date" type="datetime-local" class="form-control   @error('start_date') is-invalid @enderror" name="start_date"  required autocomplete="start_date" autofocus>

my controller

$this -> validate($request ,[

            'start_date' => [ Rule::unique('reservations')->where(function($query) use ($request) {
                $query->where('pitch_id', 'LIKE','%'.$request->pitch_id.'%');
              })],
              'end_date'=> 'required,datetime,before:start_date',
            ]);


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/37qNG4o
via IFTTT

Aucun commentaire:

Enregistrer un commentaire