vendredi 12 juin 2020

Laravel validation custom messages not showing

i am trying to validate my startdate and end date start date work perfectly and enddate works but the error message dont show if i put a the enddate before the second date the validtor works but the error message dont 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 dont



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire