In this video, I will go through one Laravel API Controller and suggest some improvements. Would you add anything else?
00:00 Intro
00:54 Reformat for Readability
02:16 Get Auth User ID
02:50 2 DB Queries into 1
04:07 Form Request validated
05:17 Variable Naming
05:53 If-else to Try-catch
07:05 Route Model Binding
08:09 Early Returns
Related video: Danger of Using $request-all(), and How to Protect
Playlist of more code reviews:
- - - - -
Support the channel by checking out my products:
- My Laravel courses membership:
- Laravel QuickAdminPanel:
- Livewire Kit Components:
- - - - -
Ot
...her places to follow:
- My weekly Laravel newsletter:
- My personal Twitter:Show more