Junior Code Review: Better Routes, CRUDs and Validation

  Рет қаралды 60,631

Laravel Daily

Laravel Daily

Күн бұрын

Пікірлер: 88
@randomguy5922
@randomguy5922 3 жыл бұрын
It's a very tedious task to review someone's code....thanks sir for bringing this great CODE REVIEW content. This actually helps us to rectify our mistakes because we also do a lot of these bad coding practices
@JSONFX
@JSONFX 3 жыл бұрын
This is by far the best code reviews i've seen in laravel here on youtube. Well done! I'll be watching more videos and learn more.
@friedrichvillegasmurillo9775
@friedrichvillegasmurillo9775 2 жыл бұрын
smooth
@jordysinke
@jordysinke 3 жыл бұрын
The $request->validate() function also return an array of validated fields, you can use that if you don't want a separate FormRequest class.
@JeremyStreich
@JeremyStreich Жыл бұрын
He knows that, but he typically strongly pushes for form requests because he likes small files. I personally think that separate form request objects lower cohesion and increase coupling, and aren't my preference in most cases.
@ryiad2010
@ryiad2010 3 ай бұрын
very helpful video. We hope to produce more videos like this to assist junior developers. The video helps shorten the learning curve for junior developers
@grzesiekb9142
@grzesiekb9142 2 жыл бұрын
I love your code reviews
@nomamkhan174
@nomamkhan174 Жыл бұрын
me to sir.
@mahmoudelsherbeny6003
@mahmoudelsherbeny6003 2 жыл бұрын
you are great sir, this help us to avoid these mistakes. Thank you!
@venzolarte7023
@venzolarte7023 Жыл бұрын
I learned a lot about this topic, I hope more code review contents sir!
@ricko13
@ricko13 3 жыл бұрын
Thank you for another daily video Sir.
@RodrigoMedeirosBrazil
@RodrigoMedeirosBrazil 3 жыл бұрын
Those code reviews help me to much! Thanks for this content!
@ivandez1811
@ivandez1811 3 жыл бұрын
me too!
@onestpaul3353
@onestpaul3353 3 ай бұрын
Thank You So much. This Review is amazing
@joshuaheathcote2116
@joshuaheathcote2116 3 жыл бұрын
I love this! This is probably the best thing I've come across on KZbin for learning.
@steveag8018
@steveag8018 3 жыл бұрын
Amazing Video Sir! I’m trying to climb to intermediate level and playing around with packages, and your video truly amazed me! I have learnt a lot from u.
@mahmoudelbashir9984
@mahmoudelbashir9984 Жыл бұрын
you are doing grate thing sir! thanks!!
@adebajooluwaseyi2124
@adebajooluwaseyi2124 3 жыл бұрын
another bombshell video, my daily routine
@belce1982
@belce1982 3 жыл бұрын
Thanks Povilas as always! Keep working!
@markmacapagal29
@markmacapagal29 3 жыл бұрын
Everyday I learned new things. Thanks
@SmailPeche
@SmailPeche 3 жыл бұрын
Thank you, i learn new things everyday with you, thank you very much
@muzika5001
@muzika5001 2 жыл бұрын
Nice explanation!🎉
@tenariusstuff7303
@tenariusstuff7303 3 жыл бұрын
It´s very awesome to sharing your experiences with us. Thank you very much for that.
@RenanFxDs01
@RenanFxDs01 3 жыл бұрын
good video as always, greetings from Brazil
@matiasmartinflores1683
@matiasmartinflores1683 3 жыл бұрын
yo man, your seniors tips are awesome, i realy like when the code it transformed in more readeble. i will implements all what i have learned today
@GergelyCsermely
@GergelyCsermely 3 жыл бұрын
Thank You, very good video as usual.
@ممدو-ص1ث
@ممدو-ص1ث 3 жыл бұрын
wow , that was amazing 😍😍 pls keep going this way
@abdullah.alhabal
@abdullah.alhabal 6 ай бұрын
you are Great man ✨
@felipeveiga87
@felipeveiga87 3 жыл бұрын
thanks from Brazil!
@AndersFloor
@AndersFloor 3 жыл бұрын
Great videos. Insightful, to the point. Thanks!
@developersmeetup536
@developersmeetup536 3 жыл бұрын
Thanks for the code review, really learned a lot
@Rocknrolla112
@Rocknrolla112 3 жыл бұрын
more reviews please ! :)
@cbob3769
@cbob3769 3 жыл бұрын
You would need to manually map is_donor from the database to blood_donor from the request
@shamarkellman
@shamarkellman 3 жыл бұрын
For the home route you can just a redirect rather than having it load the view
@JouvaMoufette
@JouvaMoufette 3 жыл бұрын
Actually I bet it's for a different reason. I bet it's because logging in directs you to /home by default, and the correct solution there would be to configure the Auth portion of the code to default its home page to /
@denisgusto
@denisgusto 3 жыл бұрын
Thanks teacher!
@Jurigag
@Jurigag 3 жыл бұрын
7:24 personally i don't like it, it's better to pass variables from controller into the view. Using auth()->user() in blade file causes uncessary function calls, as well it adds unnecessary logic(of getting current authenticated user) to view - if there is any method calls in views, especially like chained calls then i think it's too complex.
@_xplore
@_xplore 2 жыл бұрын
Thanks.
@7105597
@7105597 3 жыл бұрын
Hey Laravel Daily, this videos are so useful!, they help me a lot. What IDE and extensions (if this is the case) do you use to develop with laravel (backend-api). My VS Code doesn't autocomplete anything
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I don't know about VS code, I use phpstorm
@farham_harvianto
@farham_harvianto 3 жыл бұрын
What is the Editor and Plugin? awesome
@JouvaMoufette
@JouvaMoufette 3 жыл бұрын
I'm not a betting man, but I feel like the /home URL exists because that's the default for when you log in, and the correct solution there would be to configure it to use the / path instead. I can't think of any other reason why the path for /home exists
@diatm1506
@diatm1506 3 жыл бұрын
I agree with you. Do you agree with me? There are 2 routes / login / register for non-user authentication. If there are sign in and sign up forms on one page, then it is correct to do the path / But if they are divided into separate pages / login, / register then what will the path / be? You need to redirect when entering the site along the path to / to / login (aliase / and /login)
@travholt
@travholt 3 жыл бұрын
Very helpful!
@vitouvitou5269
@vitouvitou5269 3 жыл бұрын
Thanks teacher
@1234matthewjohnson
@1234matthewjohnson 3 жыл бұрын
great stuff!
@ahmedalkhazouri365
@ahmedalkhazouri365 3 жыл бұрын
Thank you
@codewithtee
@codewithtee 3 жыл бұрын
Beautiful ❤️
@yungifez
@yungifez 3 жыл бұрын
What's the difference between put and post
@javierr5845
@javierr5845 3 жыл бұрын
these series help a lot, excellent work as always. I wanted to ask about what approach you consider best when displaying different columns of a table when using laravel as API, for example when I extract a single post from the database I want to show all the fields, but when I request all of them, I only want to extract 2 fields. In this case it is better to create two separate resources or specify the fields in the corresponding method? thanks a lot!
@Jose-oz1by
@Jose-oz1by 3 жыл бұрын
You can use pluck function in collections if your collections has 3 field like: name, age, birth_date and You only want to retrieve name you can make somethign like this: $collection->pluck('name'); (fake example: User::get()->pluck('name', 'anotherfield);) check laravel documentation :) laravel.com/docs/8.x/collections#method-pluck
@elandlord
@elandlord 3 жыл бұрын
Using the query scopes sounds like it would solve your problem. Instead of simply calling Model::all();, you could also write: Model::query()->select(‘field_1’, ‘field_2’)->get();. It will solve your problem and also increase the speed the records are loaded. You could refactor these select statements to a local or global scope (see: laravel.com/docs/8.x/eloquent#query-scopes ). You could create a scope for when you only want to extract the two fields for a single post, add them to your Eloquent Model class (or create a separate class like so, for example a user Eloquent model): public function newEloquentBuilder($query): UserQueryBuilder { return new UserQueryBuilder($query); } Example query scope for users:
@rakeshbisht77
@rakeshbisht77 3 жыл бұрын
Hi sir , Is it good practice to use static method in laravel model file like below public static function question($paper_id) { return self::where('paper_id',$paper_id); }
@Spoutnik1707
@Spoutnik1707 3 жыл бұрын
Do you use any extensions/plugins with phpstorm?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Not really, but I recommend Laravel Idea
@amitdev1485
@amitdev1485 3 жыл бұрын
Great
@rohannnsingh84
@rohannnsingh84 3 жыл бұрын
sir please can u make a video on Auth customization which is inbuilt in laravel as i work in api development and i wanted to customize Auth() of laravel or any suggestion please
@bumblebity2902
@bumblebity2902 3 жыл бұрын
Sir, how to avoid, FormRequest and middleware conflict, when in Middleware class I get error that FormRequest class does not exist. I use store method which validates from FormRequest class and also is protected by middleware class which use basic Request class. How fix that issue?
@ghifarik335
@ghifarik335 3 жыл бұрын
Hello sir, may i know the ext for filling up some form?? Thank you
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Fake Filler.
@learning7760
@learning7760 3 жыл бұрын
Hello sir, we need a apiato laravel video session
@javieru5871
@javieru5871 3 жыл бұрын
I think that project was written by at least 2 different developers. You can tell that because of the inconsistencies pointed out.
@nouira2185
@nouira2185 3 жыл бұрын
is there a way to request a user re-authentification when he try to modify something important (with jetstream ?) thanks !
@bumblebity2902
@bumblebity2902 3 жыл бұрын
Use middleware class.
@AbrarAhmad-mz8vl
@AbrarAhmad-mz8vl 3 жыл бұрын
Laravel confirmed middleware. Which ask for password again and store confirmed session for few minutes.
@mateusssantana
@mateusssantana 3 жыл бұрын
Hello, first of all I would like to congratulate you for the videos and tips about laravel. I really appreciate that. I have a doubt. In controller of update profile, when we have the model $fillable field setted, we can't just pass the request to update method? Like ```auth()->user()->update($request->all())``` safely? The fillable attribute in model doesn't grant that none unspectable fields like "is_admin" will be injected? Thanks a lot
@LaravelDaily
@LaravelDaily 3 жыл бұрын
You can. But, in this case, is_admin is fillable, too.
@mateusssantana
@mateusssantana 3 жыл бұрын
@@LaravelDaily Oh of course! Great job. Thank you!
@abdulsamiaalashiq5925
@abdulsamiaalashiq5925 3 жыл бұрын
can i send project to review, the project by laravel and laravel-mix vue, vuex, vue route ?
@abdulsamiaalashiq5925
@abdulsamiaalashiq5925 3 жыл бұрын
the project is user dashboard wit sanctum api auth
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Sorry, currently I have already a long list of projects to review. Maybe in a few months.
@abdulsamiaalashiq5925
@abdulsamiaalashiq5925 3 жыл бұрын
@@LaravelDaily ok Thanks a lot for this videos, it's very helpful
@info-pedia
@info-pedia Жыл бұрын
what is this IDE please ?
@LaravelDaily
@LaravelDaily Жыл бұрын
PHPStorm
@DerTim
@DerTim 3 жыл бұрын
I have a request for a video! How to deploy laravel on plesk. Keep struggling doing this. Cant migrste the database and I dont want to switch to a vps because i dont know how to configure a Mailserver :/
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I don't recommend using shared hosting for any Laravel projects. Learn how to use vps, this is my advice.
@shoaib9800
@shoaib9800 3 жыл бұрын
Share the git link of the code, please.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I don't have a permission to do that, it's not my code.
@EmonKhan-sr5zg
@EmonKhan-sr5zg 3 жыл бұрын
In profile update - it can be more shorter with all() method. Just need to undeclare those protected property (like: is_admin) on the $fillable property or define in $guarded as a same. Then we can use $request->all() to save the model. Tip: whenever we need to update $guarded property, we can get the object $user = auth()->user() then $user->is_admin = 1 then $user->save()
@rolandosanches2344
@rolandosanches2344 3 жыл бұрын
Not relate to Laravel but (bootstrap stuff)... he is using primary color in all button. Primary should indicate main action in the page and all other button shold be secondary. I prefere to use success color to indicate buttons that add something.
@47Lancelot
@47Lancelot 3 жыл бұрын
8:40 bug introduced, $user->is_donor = $request->blood_donor;
@mohammadimran2219
@mohammadimran2219 3 жыл бұрын
blood_donor key must've contained a boolean value.
@bc0078
@bc0078 3 жыл бұрын
Instead of looping the errors in the blade to see them, you can also check them in the debug bar in the Sessions section under errors
@diatm1506
@diatm1506 3 жыл бұрын
Please Sir Laravel Daily make a video course Chat. Laravel8 + Vue 3 or React + pusher (websockets) + Restfull api + jwt etc I would take it for 200 dollars (Or any other price) or more. I want to become a developer and master everything Template chatvia -> themeforest
@AksoomHussain7866
@AksoomHussain7866 3 жыл бұрын
I don't like data 🤣🤣
@muhammadfarhanahmed9280
@muhammadfarhanahmed9280 3 жыл бұрын
Thanks teacher
Junior Laravel CRUD+jQuery Code Review: Random Tips in 10 Minutes
10:29
Laravel Junior Code Review: Security and Consistency
17:29
Laravel Daily
Рет қаралды 49 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 22 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 105 МЛН
Laravel Junior Code Review: 12 Tips on Everything
15:30
Laravel Daily
Рет қаралды 75 М.
Junior Code Review: Laravel Routes, Middleware, Validation and more
19:57
NextJS and Laravel Can Be Friends
23:54
Laravel
Рет қаралды 29 М.
Junior Code Review: Laravel API Controller - 8 Tips for Improvement
10:17
2D Game Engine by 13-YEAR-OLD! // Code Review
27:36
The Cherno
Рет қаралды 268 М.
Laravel Code Review: Multi-Tenancy, Events and Queues
14:40
Laravel Daily
Рет қаралды 37 М.
Код ревью участника Laravel комьюнити CutCode
14:46
Просто о Web Development. CutCode
Рет қаралды 4,9 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 22 МЛН