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. I would like to reply to a couple of your points to see where I went wrong or something like that. :D
'you could extract out the Event creation into a different method (`$this->createEvent(or class.' -> Fair point i will do that.
Position-specific questions need a bit of explanation. I wanted to create a database field where each position could have optional or required questions. For example, for the position of Laravel Developer, a question could be: Do you have experience with Filament? Or, the same company hiring for a blue-collar worker in a place where smoking is prohibited, the question could be: Can you work a 12-hour shift without smoking?
To answer your question
The asked line $position->
position_specific_questionsare basicly coming from the injected Position model' The rules are defined and parsed here, then do a database store in an separate class. I dislike how things are all mixed up in the controller - simple logic - take the input and pass inward for the response, then send it out.'
I agree with you, I didn't like it either. I just couldn't figure out a way to do the specific rules validation in a separate request file because they are coming from the form itself, but the name can be anything. This section will need rework.
'You don't need name the parameter $validatedData, that should be expected '
To be honest, when I switched to the new AI, I ran a refactoring on this one, and it renamed it to this. I didn't even notice it. :D The original name was simply
$data.About the tests, you are completely right. I should work on expanding my knowledge about testing. I started doing tests about a month ago and am still working on it.