Laravel: Why/How To Add Multiple Validation 'Layers'?

preview_player
Показать описание
What if you have passed the validation, but then you need to perform another complex check, that may return another validation error? Let me show you TWO examples.

- - - - -
Support the channel by checking out our products:
Рекомендации по теме
Комментарии
Автор

This is exactly what I do throw the validation exception, and then catch it in the handler to do extra logic depending on the type of request.

It's great because it's the same error as the validator so you don't need any extra logic to differentiate it

gaffygaffy
Автор

This is my fav snippet when i have multiple form in one page with some input name: ☺
if($validator->fails()){
return . '#userPurge')
->withErrors($validator, 'purge')
->withInput();
}

lahoucineoldakdim
Автор

if you are developing a SPA or API only, you have to use ValidationException, maybe combined with axios interceptor if is SPA. Redirect is not available

giacomogaravaglia
Автор

Hello Mr. Povilas, can you make a tutorial on how to make a pagination using laravel, vue and tailwind? You already made a video about vue pagination, but it seems that the package is using bootstrap css.

saybernaldez
join shbcf.ru