Do you think I should create more code review tutorials? Let me know! Follow me or subscribe to my newsletter to get notified when my course is released: - Twitter: twitter.com/codewithdary - Instagram: instagram.com/codewithdary/ - Blog: blog.codewithdary.com/
@jackelofnar Жыл бұрын
Hi Dary, I hope you continue with this series as someone who is still learning Laravel you gave alotof great tips.
@codewithdary Жыл бұрын
Thank you Jack! If the video performs well (and it's doing right now) I will definitely continue on making more of these!
@Tux0xFF Жыл бұрын
This channel is a goldmine, you dont get to see these type of reviews and content unless its premium content, glad that i found it
@codewithdary Жыл бұрын
Thank you so much for the compliments, means the world to me
@baochungpro1996 Жыл бұрын
Great, please continue with this kinda series. Thanks so much, Dary.
@codewithdary Жыл бұрын
Will do, thank you so much!
@petermwangi7274 Жыл бұрын
Much informative Dary. Definitely looking to more of your code review tutorials.
@codewithdary Жыл бұрын
Thanks, will do Peter!
@basharumar2912 Жыл бұрын
promise fulfilled! Thank you mr Dary and looking forward to having more tutorials like this.
@codewithdary Жыл бұрын
Appreciate the kind words Bashar. If it performs well, I will definitely continue on making content like this!
@waleedgrt4904 Жыл бұрын
Hey Dary, At 22:33, the "validated" method is more convenient than the "only" method.
@codewithdary Жыл бұрын
Both options work fine, there isn't a right or wrong right here, I'm just not really a fan of it. I prefer to explicitly define and insert data into the database. Completely fine using the other method.
@b3rking Жыл бұрын
Hello dary, thanks for the review and for the corrections, i'll make sure to apply them in my next versions. Again thanks a lot, it means a lot. Keep it up!
@codewithdary Жыл бұрын
Appreciate it, keep on going with the good work!!
@GavinKimpson Жыл бұрын
Dude your videos are great, you'll be at 100k subscribers in no time!
@codewithdary Жыл бұрын
Thank you so much Gavin, I hope so!!
@user-rv5rm1yl1g10 ай бұрын
That's a good video! But I have a few points that concerns me. If you injected FormRequest class instead of general Request, then you don't need to call "$request->validated()" to trigger validation. It would be taken care of by Laravel itself. I think it's not a good point to use "auth()" helper inside any models function - it seem not obvious and has it's own issues. I would use "$this" instead. For me it seem more convenient.
@codewithdary10 ай бұрын
Yes, that is true in Laravel. If you inject a FormRequest class instead of the general Request class, you don't need to call "$request->validated()" to trigger validation. Laravel automatically handles the validation process when using FormRequest classes.
@grzesiekb9142 Жыл бұрын
$request->validated() returns only validated fields. You can safly use $model->update( $request->validated() ) i think...
@codewithdary Жыл бұрын
That is correct. The source code will not get into the method if the validation passes, so it does not really matter whether you use the $request validated or the values directly.
@DCBlogdev Жыл бұрын
brilliant video 👏
@codewithdary Жыл бұрын
Appreciate it David, especially coming from you!
@basharumar2912 Жыл бұрын
i hope one day you will teach us more about the difference between policies and guardes,listeners and observers etc.
@codewithdary Жыл бұрын
Will do in the future!!
@newtonjob7611 Жыл бұрын
@avfr Observers are simply listeners for model events. You can't choose to use one or the other. You also cannot manually fire model events from a controller, since they're internally fired by eloquent.
@igerardogc Жыл бұрын
What theme, font and spacing are u using? Nice video
@codewithdary Жыл бұрын
Theme: SynthWave 84 (Material) Font: Monaco Line height: 1.4
@ricardozapanta66563 ай бұрын
Hi Dary what extension do you use to see what type of the value needed inside the parameters ex: $table->string(column: 'extension'); the "column""
@jjplays404 Жыл бұрын
at 8:45, how your methods are showing key like $table->string(column: "something") which extension you are using to show "column" thing?
@basharumar2912 Жыл бұрын
what is the difference between using foreign or foreignID and which is better?
@codewithdary Жыл бұрын
The main difference between the two methods is that foreignId() is a shorthand method that automatically creates a column with an unsigned big integer data type and adds the foreign key constraint to that column. This can simplify the syntax of creating a foreign key constraint.
@ramzibenssaci20077 ай бұрын
thank you dary i have simple question why you sometimes use ->value and sometimes not i means in enum
@codewithdary7 ай бұрын
The ->value method is used to retrieve the underlying value of an enum instance. Enums in Laravel are implemented as objects, and ->value allows you to access the actual value stored within the enum rather than the enum object itself!
@MightyKingKala Жыл бұрын
Amazing video thanks
@codewithdary Жыл бұрын
Glad you enjoyed it Isaac!
@abukhalid5890 Жыл бұрын
putting $guarded=[] (empty array) in the model is same as $fillable=[..all request keys here..] and i think you cant put both of these two variables in the same model
@codewithdary Жыл бұрын
I'm pretty sure you can't because these two properties are used to specify which attributes are mass assignable and which are not, respectively. Well, you technically can, but Laravel will prioritize $guarded and ignore $fillable, which could lead to unexpected behavior in your application.
@tharakadoo Жыл бұрын
Hey Dary big fan
@codewithdary Жыл бұрын
Thank you so much Tara
@pauliusjankauskas8028 Жыл бұрын
Why do need $request->validated() in controller since it returns validated data from request? Doesn't validation happen automatically?
@codewithdary Жыл бұрын
That works too, just not a fan of using so many things behind the scenes :)
@codewithdary Жыл бұрын
Quick add on btw; I'm reviewing code how I should do it, not saying that it's the best way, just my way.
@pauliusjankauskas8028 Жыл бұрын
Yap, there is no best way to do it. Need to make a choice from many ways for particual situation.
@pauliusjankauskas8028 Жыл бұрын
Just was wondering if didn't make a typo, because as i knew $request->validated() returns only validated data from a request and not do validation it self. For validation, i was using $request->validate().
@grzesiekb9142 Жыл бұрын
@@codewithdary If I understand correctly validation as a formrequest then the data is always validated behind the scenes. When you use request->validated() then you only return validated data but you don't assign it anywhere. It makes no sense to me to use this method in your example.
@REAZNx Жыл бұрын
6:22 Locale is pronounced “low-kal” 🙂
@codewithdary Жыл бұрын
Thank you Lewis. Sounds like low-kal-ories 😜
@newtonjob7611 Жыл бұрын
Is there really such a method as `required` on the ColumnDefinition? Never heard of it 🤔
@codewithdary Жыл бұрын
Whoops no, I was a bit mixed-up with another framework, sorry for that!