1

When I used Laravel 5.8 I could get information about errors like this :

@if(count($errors > 0)) <ul class="error-list" > @foreach($errors->all() as $error) <li class="error-list-element">{{$error}}</li> @endforeach </ul> @endif 

It worked completly fine. Since Laravel 6.0 was released the code above results in error :

Object of class Illuminate\Support\ViewErrorBag could not be converted to int

So how can I get information about errors in Laravel 6.0?

2
  • 5
    change @if(count($errors > 0)) to @if(count($errors) > 0) Commented Sep 10, 2019 at 12:40
  • Science damn it. Stupid mistake. This topic is useless :/ Commented Sep 10, 2019 at 12:43

2 Answers 2

2

Here is code :

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

Hope this will help :)

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.