Junior Code Review: Cleaning Up Laravel CRUD

preview_player
Показать описание
Another junior code review, with 10+ random tips. I'm starting to feel that I repeat myself in different reviews, so I guess I will switch to topic-based reviews in the future.

00:00 Intro
00:41 Error: Duplicate Migrations
02:02 No Data - No Homepage
04:40 Home: Compact or NO Variables?
06:55 Controller Optimization
08:23 Global Settings
09:19 Admin User Route Group
09:54 Controller Naming
10:32 UserController and Other CRUDs
13:34 Storing Images and Thumbnails

Related articles:

Playlist for other code reviews:

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

Hello good day. I am a SAP Developer with more than 10 years of experience. And I have started with laravel 1 year ago. When I'm developing in Laravel, I don't have "logic" issues, but "best practices" issues. And I get stuck trying to find the best way to do something.

Your videos are helping me a lot in that matter.

I find your trainings very interesting and helpful.

Thank you.

bcmarcos
Автор

All of the review are so amazing, never get bored when watching your video

victordivo
Автор

This is a great series, I get so much value from it. Also, I do like the idea at the end of focusing on a specific type of refactor on each episode. That sounds like a fantastic direction to go.

remyjay
Автор

Thank you, Povilas. Your code review videos are very educational.

hungcuong
Автор

My New favourite channel on YouTube 🔥🔥 especially these code reviews 🙏🏾

bijportal
Автор

Thank you for the Spatie Media Library tip!!! I've just watched their tutorial. It is amazing.

Steviec
Автор

Hey this is my student! In my opinion he is pro not junior :) I’m glad that I have learned him so much. Greetings from pingdevs dot com, Macedonia.

mctiggaz
Автор

repetition is the mother of learning ))

Rocknrolla
Автор

You'll probably be a man of the year in a laravel community soon

alicenNorwood
Автор

cool I didn't know about the spatie media library ! Thanks for that ! ^^ I will use it for one of my project !

codecreeper
Автор

Another thing I noticed very briefly:

Unless I missed another use of $staticpages in the homepage view that needed all staticpages, the loop around $staticpages was calling ->take(4) which means they were querying ALL static pages, but only needing 4.

If that is the case, you should not be using a straight up all() and instead be using ->limit(4)->get() or ->take(4)->get()

Getting all then only getting 4 from there is VERY expensive on the database. And databases in scaled applications are often not on the same server as the web server, meaning there's a larger load on the network now.

JouvaMoufette
Автор

Povilas your job is awesome! You could do a more advance code review too? A thank you from Brazil!

thisisthelogic
Автор

Quick note about the first issue, rather than having to rename the class and file name, you could just anonymise the migration class: `return new class extends Migration`. I believe in newer Laravel versions this is actually the default so my note may be a bit outdated 😅

rporter
Автор

because your videos... php storm is become my next IDE :D

wahyudi
Автор

What Laravel admin dashboard would you recommend? I've used Vuetify in the past, and I liked it. I was looking for something more lightweight, but with VueJS functionality.

firefoxo
Автор

Hi from russia. Its very useful, especially for me.
Keep it up, your doing well 👍🏻

xqgpmkb
Автор

Thank you for video. 9:36 you deleted "check.user:Admin". But all users still can register and right a way have access to admin panel!!! Should to prevent other user to have registration on system or not delete "check.user:Admin" middleware ;)

doremidon
Автор

On 12:40 he could use inside the function (Request $request, User $id) instead everytime to FindOrFail the user id

Raysierer
Автор

cool I didn't know about the spatie media library ! Thanks for that ! ^^ I will use it for one of my project !

I would like to know if you are able to talk also about scoping in Laravel. I've been in a company that have a senior developer, and use a loooot of scopes through the hole project. And he never uses repositories (just one or two), even so it was fully needed because of the bunch of requests he made in model.
I like the repository design pattern for complexe relationships, I often use repositories (when it's necessary of course). But do you have a simple example when using scopes, when using repositories ?
And by the way, could you tell also what is the difference between a trait and a helper ? ^^

Thanks for reading me, and keep going, I love to watch your videos :)

deeploy
Автор

Thx for the video! Could you or someone please help me with the following; I have a 'catch all route' with "->where('menu', '.*')" and in my controller i'm loading in a bunch of variables though not all variables are nessecary for each single page. It depends on certains fields and/or relationships. I'm pretty sure there is a way to conditionally load in variables based on that. Could you point me in the right direction please?

winmodif