r/PHPhelp • u/MixtureNervous5473 • Jan 30 '25
Laravel reference projects - Code Review
Greetings,
Let's start with the basics. I'm a self-taught junior PHP developer. Recently I have failed a couple of interviews mostly because everyone wanted some reference projects. Unfortunately, I cannot provide any since I had a couple of jobs, but the contracts do not allow me to show the code. I decided to create a couple of projects that I can show as reference, with the context of why these projects have AI-generated frontends, simplified functionality, etc.
I would really appreciate it if you could give me a code review or your opinion about these projects. I want to improve my skills.
Links:
View all comments
Show parent comment
1
u/MixtureNervous5473 Jan 31 '25
Thanks for your review!
' Extract Validation into a Form Request' - At the time i didn't have any idea how can i use the position specific questions because of the unkown name but when i wrote my reply to equilni it came to my mind so i fixed it quickly :D
About single action controllers and abstraction: I have mixed feelings about this. When I think about a CRUD operation, in my point of view, I will need a controller, e.g., UserController, a service, e.g., UserService, and an interface, e.g., UserServiceInterface. The interface would have methods for create, update, and delete. The service would handle the business logic behind these three functions. I understand that if I bind them, then if I want to change the business logic, I only need to replace the service. However, my problem with this approach is that I have three actions in the same service which could end up really big. If I separate them, I end up with a bunch of files and code pieces. Instead of this, I sacrificed easy modification and single action controllers and achieved almost the same functionality with Actions. I mean i could create CreateUserAction handling the creation UpdateUserAction, DeleteUserAction i could inject them into the same controller if i don't want to use parameter injection i can do it with the app helper.
If i get this wrong please correct me.