welp, its for teams and clean code. but if you are a solo player then I don't see there is a need for that. i tried this way and its just very exhausting one thing leads to another and so on. sometimes You need this random code or (not clean code).
I dont know php but organizing your code is good practice. And if you want a job then you must be good at organizing your code. Built a real world application and you will understand it yourself.
i think validation purpose should be to check product_id field whether it is exists or not , you are avoiding single responsibility by doing this. But adding middleware in authorize section could be better since it avoids extra meaningless checks on validation rules.
Good advice, but bad example. I think it's better to create custom validation rule in this case. This will allow tu return more appropriate error message.
@@laravelboy its not about customize message its about there is two kind of error message the first one about the quantity and the second should be about product not found in your solution u cant because every rule has one message
thanks for making great videos, but i have to disagree with this one, you are reducing the code readability (main point), and also you can't re-use that request if you have orders in other places. i prefer to do those checks in a service or somewhere that code reader naturally expects
Top laravel instructor in youtube
Keep up the good work my boy ❤❤
اخويا ابو عمر ، الله يسعدك
which extension you are using to show placeholders like: "table: ...., column: ..... :array..... etc" ??
lara pack
This one is awesome !
Great tips.
This tip is new to me
thank you
Why add 50 lines of code in 4 different places to replace 1 if statement? I don’t understand the logic of that??
welp, its for teams and clean code. but if you are a solo player then I don't see there is a need for that. i tried this way and its just very exhausting one thing leads to another and so on.
sometimes You need this random code or (not clean code).
I dont know php but organizing your code is good practice. And if you want a job then you must be good at organizing your code. Built a real world application and you will understand it yourself.
@@Takatou__Yogiri I fire people that do this.
@@Takatou__Yogiri as i said man. opinions may differ
for scalability.
i think validation purpose should be to check product_id field whether it is exists or not , you are avoiding single responsibility by doing this. But adding middleware in authorize section could be better since it avoids extra meaningless checks on validation rules.
You have a valid point. Middleware is a good approach too
Good advice, but bad example. I think it's better to create custom validation rule in this case. This will allow tu return more appropriate error message.
Thanks 🙏
Its wrong because what about the product doesn't exist the user will get wrong message
the message can be more customized too
@@laravelboy its not about customize message its about there is two kind of error message the first one about the quantity and the second should be about product not found in your solution u cant because every rule has one message
Great job
thanks for making great videos, but i have to disagree with this one, you are reducing the code readability (main point), and also you can't re-use that request if you have orders in other places.
i prefer to do those checks in a service or somewhere that code reader naturally expects
but for me prefer middlewares
it's a great solution too