Undefined variable: message Laravel

Asked

Viewed 208 times

-2

I have the following problem in the Windows view $message is undefined in the whole variable $message and standard at least as indicated in the documentation in the validation part of Forms Blade

 @error('cpf_cnpj')
 <span class="invalid-feedback" role="alert">
     <strong>{{ $message }}</strong>
 </span>
 @enderror

Error

inserir a descrição da imagem aqui

How can I this fixed this error?

  • where it says in the documentation that $message is always available?

  • I think you’ve got the wrong idea https://laravel.com/docs/5.7/views#Passing-data-to-views https://laravel.com/docs/5.7/validation#named-error-bags

  • When returning to the view you are not informing the $message, has how to show more information about your login function ?

  • in case I used make:auth to create templates and controlles.

  • What version of Laravel?

  • Try using the $errors->all() to catch all the mistakes, then you make a foreach and displayed each one.

  • @Kayo Bruno what happened was the following agent was working on the version 6 of the Laravel and was working all right then agent I go to the 5.8 then Blade stopped recognizing the validations.

Show 2 more comments

1 answer

0


Do a test with this solution:

@if($error->has('cpf_cnpj'))
<span class="invalid-feedback" role="alert">
     <strong>{{ $error->first('cpf_cnpj')}}</strong>
 </span>
@endif

Browser other questions tagged

You are not signed in. Login or sign up in order to post.