dimanche 23 juillet 2017

Error partial not showing messages

The following code is in a partial named errors.blade.php:

@if ($errors->any())
<div class="form-group">
  <div class="alert alert-danger">
    <ul>
      @foreach($errors->all() as $error)
        <li></li>
      @endforeach
    </ul>
  </div>
</div>
@endif

It's being called in master.blade.php:

<body>
    @include("layouts.nav")

    <div class="container-fluid">
      <div class="row">
        @include("layouts.sidebar")

        @yield("content")
        @include("layouts.errors")
      </div>
    </div>
    @include("layouts.footer")
  </body>

After submitting a form and using the validate() function, nothing is shown on the page that a user is redirected to. If I take the code from errors.blade.php and put it directly into the products.index.blade.php file, the errors show as intended. This is not desirable as I want errors and partials of a similar nature to be shown across all views if applicable.

Why aren't they working?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire