Laravel Code Review - Refactoring Form Requests and Advanced Validation Rules

preview_player
Показать описание

Click here to subscribe

Reddit

Medium

Facebook

Twitter

LinkedIn

Github

#laravel #codereview #webdevelopment
Рекомендации по теме
Комментарии
Автор

6:10 This validation rule can even be made shorter and better by calling and returning the ->doesntExist() method directly instead of calling ->first(), assigning it to a variable and then checking that variable. So the whole statement would look like this: return User::where('email', $value)->where('type',

CodingWithPixelFix
Автор

Nice video, good explain also. I'm new to laravel and video's like these are very handy! Thanks

MrSonicastra
Автор

i dindt knew about getting all the data from request in a custom validation rule, thanks!

marcelodheni
Автор

nice video, i think using
Rule::Unique('Users', 'Email')->where('type', $this->input(''type');
is better than using custom validation rule

giveaway
Автор

Hi, I'm quite new in Laravel. At the moment I'm watching your refactoring tutorials and I found them very useful. My controllers look dreadful. Before watching this video, I managed to implement my advanced rules using the validation Rule inside the "form request".
Something like...
I wander if I should move these "rules" in the way you showed in this tutorial or I can stick with it.
Thank you so much for shearing your knowledge.

robertomanna
Автор

thanks for the video, i think it's better to create the user with mass assignment **$request->validated()** and use a **mutator** inside the user model to bcrypt the password before storing it, thanks for the video

darkman
Автор

Hi!
I the store methode you could use maybe the $request->validated(); and add only the password.

GergelyCsermely
Автор

I like this video, but .... what about the test? 😅

omarpollo
Автор

That rule could have been shortened to return !isnull($user) Thanks for sharing!

micosair
visit shbcf.ru