vendredi 12 juin 2020

Laravel validation custom messages not showing

i am trying to validate my startdate and end date

start date works perfectly and enddate works

but the error message doesn't show

if i put the enddate before the second date the validtor works but the error message doesn't show

my validator in the controller

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

]);

my view

<div class="col-md-5">
              <input type="datetime-local" class="form-control " name="end_date"  id="end_date" required>
              @error('end_date')
              <span class="invalid-feedback " role="alert">
                  <strong></strong>
              </span>
          @enderror


         </div>

my custom messages

'custom' => [
        'start_date' => [
            'unique' => 'date deja reservé changer du date ou changer le terrain',
        ],
        'end_date' => [
            'after' => 'la date de fin doit etre apres la date du debut',
        ],
    ],

the messages of the start_date works but the end_date doesn't



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

Aucun commentaire:

Enregistrer un commentaire