You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having the same issue trying to force to appear a message to give visibility to an improperly controlled error.
In my case, I found that a FormRequest with an improperly validation, can cause not pass a validation and not see the error. I think to show it on debugbar for get the needed feedback that what is happening.
I try to do a Middleware to catch the error, dd show the message that debugbar:addMessage doesn't show.
I try to do another class to extends, that have failedValidation, and the same problem. And in this point I try some other things.
This is my final test, that seems to show a non expected behaviour:
<?php
namespace App\Http\Requests;
use Barryvdh\Debugbar\Facades\Debugbar;
use Exception;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
class FormRequestValidation extends FormRequest
{
/**
* Manejar la validación fallida.
*/
protected function failedValidation(Validator $validator)
{
// Registrar errores en Debugbar
Debugbar::addMessage($validator->errors()->toArray(), 'Validation failed');
// throw new Exception('Validation failed: ' . json_encode($validator->errors()->toArray(), JSON_PRETTY_PRINT));
// Llamar al comportamiento predeterminado (lanza ValidationException)
parent::failedValidation($validator);
}
}
With the throw commented, I can't see messages on debugbar.
With the throw uncommented, I can see TWO messages on debugbar.
To try to reproduce this problem, is only needed a form validation with a required field that is not submited.
What is the solution? I don't know, but a lot of people seems to have this kind of problem, but no solution with a problem that seems to happen from nearly 2014.
The text was updated successfully, but these errors were encountered:
I'm having this issue that are also related to this:
I'm having the same issue trying to force to appear a message to give visibility to an improperly controlled error.
In my case, I found that a FormRequest with an improperly validation, can cause not pass a validation and not see the error. I think to show it on debugbar for get the needed feedback that what is happening.
I try to do a Middleware to catch the error, dd show the message that debugbar:addMessage doesn't show.
I try to do another class to extends, that have failedValidation, and the same problem. And in this point I try some other things.
This is my final test, that seems to show a non expected behaviour:
With the throw commented, I can't see messages on debugbar.
With the throw uncommented, I can see TWO messages on debugbar.
To try to reproduce this problem, is only needed a form validation with a required field that is not submited.
What is the solution? I don't know, but a lot of people seems to have this kind of problem, but no solution with a problem that seems to happen from nearly 2014.
The text was updated successfully, but these errors were encountered: