As a part of my new Laravel mentorship program in my home country Lithuania, I started doing code reviews of my student developers. Here's a 20-minute example that I decided to publish on Youtube - should be useful to you guys, too.
00:00 - Intro
01:33 - Route Grouping
04:08 - Shorter Middleware Class
07:01 - Middleware with Parameters
09:06 - Migrations with Foreign Keys
10:32 - Controller Index Refactor
14:03 - Code Styling
14:46 - Store and Validation
18:00 - Update and Route Model Binding
Related resources:
- Route grouping: https://laravel.com/docs/8.x/routing#route-groups
- Middleware with Parameters: https://laravel.com/docs/8.x/middleware#middleware-parameters
- Migration foreign keys: https://laravel.com/docs/8.x/migrations#foreign-key-constraints
- Laravel Validation with Form Requests: https://laravel.com/docs/8.x/validation#form-request-validation
- Route Model Binding: https://laravel.com/docs/8.x/routing#route-model-binding
- Eloquent "When" method: https://laraveldaily.com/less-know-way-conditional-queries
- Code Styling and PSR-12: https://blog.quickadminpanel.com/psr-2-and-psr-12-why-we-need-standards-and-how-to-apply-them/
- - - - -
Try our Laravel QuickAdminPanel: https://bit.ly/quickadminpanel
Enroll in my Laravel courses: https://laraveldaily.teachable.com
Use my Livewire components: https://livewirekit.com