It's a very tedious task to review someone's code....thanks sir for bringing this great CODE REVIEW content. This actually helps us to rectify our mistakes because we also do a lot of these bad coding practices
He knows that, but he typically strongly pushes for form requests because he likes small files. I personally think that separate form request objects lower cohesion and increase coupling, and aren't my preference in most cases.
Amazing Video Sir! I’m trying to climb to intermediate level and playing around with packages, and your video truly amazed me! I have learnt a lot from u.
Actually I bet it's for a different reason. I bet it's because logging in directs you to /home by default, and the correct solution there would be to configure the Auth portion of the code to default its home page to /
I'm not a betting man, but I feel like the /home URL exists because that's the default for when you log in, and the correct solution there would be to configure it to use the / path instead. I can't think of any other reason why the path for /home exists
I agree with you. Do you agree with me? There are 2 routes / login / register for non-user authentication. If there are sign in and sign up forms on one page, then it is correct to do the path / But if they are divided into separate pages / login, / register then what will the path / be? You need to redirect when entering the site along the path to / to / login (aliase / and /login)
Hey Laravel Daily, this videos are so useful!, they help me a lot. What IDE and extensions (if this is the case) do you use to develop with laravel (backend-api). My VS Code doesn't autocomplete anything
7:24 personally i don't like it, it's better to pass variables from controller into the view. Using auth()->user() in blade file causes uncessary function calls, as well it adds unnecessary logic(of getting current authenticated user) to view - if there is any method calls in views, especially like chained calls then i think it's too complex.
In profile update - it can be more shorter with all() method. Just need to undeclare those protected property (like: is_admin) on the $fillable property or define in $guarded as a same. Then we can use $request->all() to save the model. Tip: whenever we need to update $guarded property, we can get the object $user = auth()->user() then $user->is_admin = 1 then $user->save()
sir please can u make a video on Auth customization which is inbuilt in laravel as i work in api development and i wanted to customize Auth() of laravel or any suggestion please
Sir, how to avoid, FormRequest and middleware conflict, when in Middleware class I get error that FormRequest class does not exist. I use store method which validates from FormRequest class and also is protected by middleware class which use basic Request class. How fix that issue?
Not relate to Laravel but (bootstrap stuff)... he is using primary color in all button. Primary should indicate main action in the page and all other button shold be secondary. I prefere to use success color to indicate buttons that add something.
Hi sir , Is it good practice to use static method in laravel model file like below public static function question($paper_id) { return self::where('paper_id',$paper_id); }
these series help a lot, excellent work as always. I wanted to ask about what approach you consider best when displaying different columns of a table when using laravel as API, for example when I extract a single post from the database I want to show all the fields, but when I request all of them, I only want to extract 2 fields. In this case it is better to create two separate resources or specify the fields in the corresponding method? thanks a lot!
You can use pluck function in collections if your collections has 3 field like: name, age, birth_date and You only want to retrieve name you can make somethign like this: $collection->pluck('name'); (fake example: User::get()->pluck('name', 'anotherfield);) check laravel documentation :) laravel.com/docs/8.x/collections#method-pluck
Using the query scopes sounds like it would solve your problem. Instead of simply calling Model::all();, you could also write: Model::query()->select(‘field_1’, ‘field_2’)->get();. It will solve your problem and also increase the speed the records are loaded. You could refactor these select statements to a local or global scope (see: laravel.com/docs/8.x/eloquent#query-scopes ). You could create a scope for when you only want to extract the two fields for a single post, add them to your Eloquent Model class (or create a separate class like so, for example a user Eloquent model): public function newEloquentBuilder($query): UserQueryBuilder { return new UserQueryBuilder($query); } Example query scope for users:
Hello, first of all I would like to congratulate you for the videos and tips about laravel. I really appreciate that. I have a doubt. In controller of update profile, when we have the model $fillable field setted, we can't just pass the request to update method? Like ```auth()->user()->update($request->all())``` safely? The fillable attribute in model doesn't grant that none unspectable fields like "is_admin" will be injected? Thanks a lot
I have a request for a video! How to deploy laravel on plesk. Keep struggling doing this. Cant migrste the database and I dont want to switch to a vps because i dont know how to configure a Mailserver :/
Please Sir Laravel Daily make a video course Chat. Laravel8 + Vue 3 or React + pusher (websockets) + Restfull api + jwt etc I would take it for 200 dollars (Or any other price) or more. I want to become a developer and master everything Template chatvia -> themeforest
It's a very tedious task to review someone's code....thanks sir for bringing this great CODE REVIEW content.
This actually helps us to rectify our mistakes because we also do a lot of these bad coding practices
The $request->validate() function also return an array of validated fields, you can use that if you don't want a separate FormRequest class.
He knows that, but he typically strongly pushes for form requests because he likes small files. I personally think that separate form request objects lower cohesion and increase coupling, and aren't my preference in most cases.
This is by far the best code reviews i've seen in laravel here on youtube. Well done! I'll be watching more videos and learn more.
smooth
I love your code reviews
me to sir.
Thank you for another daily video Sir.
Those code reviews help me to much! Thanks for this content!
me too!
I learned a lot about this topic, I hope more code review contents sir!
you are great sir, this help us to avoid these mistakes. Thank you!
I love this! This is probably the best thing I've come across on UA-cam for learning.
another bombshell video, my daily routine
you are doing grate thing sir! thanks!!
It´s very awesome to sharing your experiences with us. Thank you very much for that.
Nice explanation!🎉
Thank you, i learn new things everyday with you, thank you very much
Amazing Video Sir! I’m trying to climb to intermediate level and playing around with packages, and your video truly amazed me! I have learnt a lot from u.
yo man, your seniors tips are awesome, i realy like when the code it transformed in more readeble. i will implements all what i have learned today
Everyday I learned new things. Thanks
Thanks Povilas as always! Keep working!
Thank You, very good video as usual.
good video as always, greetings from Brazil
you are Great man ✨
wow , that was amazing 😍😍 pls keep going this way
Thanks for the code review, really learned a lot
thanks from Brazil!
Great videos. Insightful, to the point. Thanks!
more reviews please ! :)
For the home route you can just a redirect rather than having it load the view
Actually I bet it's for a different reason. I bet it's because logging in directs you to /home by default, and the correct solution there would be to configure the Auth portion of the code to default its home page to /
You would need to manually map is_donor from the database to blood_donor from the request
Thanks teacher!
Thanks teacher
Thanks.
Very helpful!
I'm not a betting man, but I feel like the /home URL exists because that's the default for when you log in, and the correct solution there would be to configure it to use the / path instead.
I can't think of any other reason why the path for /home exists
I agree with you. Do you agree with me? There are 2 routes / login / register for non-user authentication. If there are sign in and sign up forms on one page, then it is correct to do the path / But if they are divided into separate pages / login, / register then what will the path / be? You need to redirect when entering the site along the path to / to / login (aliase / and /login)
great stuff!
Thank you
Beautiful ❤️
Hey Laravel Daily, this videos are so useful!, they help me a lot. What IDE and extensions (if this is the case) do you use to develop with laravel (backend-api). My VS Code doesn't autocomplete anything
I don't know about VS code, I use phpstorm
7:24 personally i don't like it, it's better to pass variables from controller into the view. Using auth()->user() in blade file causes uncessary function calls, as well it adds unnecessary logic(of getting current authenticated user) to view - if there is any method calls in views, especially like chained calls then i think it's too complex.
Instead of looping the errors in the blade to see them, you can also check them in the debug bar in the Sessions section under errors
I think that project was written by at least 2 different developers. You can tell that because of the inconsistencies pointed out.
In profile update - it can be more shorter with all() method.
Just need to undeclare those protected property (like: is_admin) on the $fillable property or define in $guarded as a same. Then we can use $request->all() to save the model.
Tip: whenever we need to update $guarded property, we can get the object $user = auth()->user() then $user->is_admin = 1 then $user->save()
What's the difference between put and post
sir please can u make a video on Auth customization which is inbuilt in laravel as i work in api development and i wanted to customize Auth() of laravel or any suggestion please
Hello sir, we need a apiato laravel video session
Sir, how to avoid, FormRequest and middleware conflict, when in Middleware class I get error that FormRequest class does not exist. I use store method which validates from FormRequest class and also is protected by middleware class which use basic Request class. How fix that issue?
Not relate to Laravel but (bootstrap stuff)... he is using primary color in all button. Primary should indicate main action in the page and all other button shold be secondary. I prefere to use success color to indicate buttons that add something.
What is the Editor and Plugin? awesome
Hi sir , Is it good practice to use static method in laravel model file like below
public static function question($paper_id)
{
return self::where('paper_id',$paper_id);
}
Great
these series help a lot, excellent work as always. I wanted to ask about what approach you consider best when displaying different columns of a table when using laravel as API, for example when I extract a single post from the database I want to show all the fields, but when I request all of them, I only want to extract 2 fields. In this case it is better to create two separate resources or specify the fields in the corresponding method? thanks a lot!
You can use pluck function in collections
if your collections has 3 field like: name, age, birth_date and You only want to retrieve name
you can make somethign like this:
$collection->pluck('name');
(fake example: User::get()->pluck('name', 'anotherfield);)
check laravel documentation :)
laravel.com/docs/8.x/collections#method-pluck
Using the query scopes sounds like it would solve your problem. Instead of simply calling Model::all();, you could also write: Model::query()->select(‘field_1’, ‘field_2’)->get();. It will solve your problem and also increase the speed the records are loaded.
You could refactor these select statements to a local or global scope (see: laravel.com/docs/8.x/eloquent#query-scopes ).
You could create a scope for when you only want to extract the two fields for a single post, add them to your Eloquent Model class (or create a separate class like so, for example a user Eloquent model):
public function newEloquentBuilder($query): UserQueryBuilder
{
return new UserQueryBuilder($query);
}
Example query scope for users:
Hello sir, may i know the ext for filling up some form?? Thank you
Fake Filler.
Do you use any extensions/plugins with phpstorm?
Not really, but I recommend Laravel Idea
Hello, first of all I would like to congratulate you for the videos and tips about laravel. I really appreciate that.
I have a doubt. In controller of update profile, when we have the model $fillable field setted, we can't just pass the request to update method? Like ```auth()->user()->update($request->all())``` safely? The fillable attribute in model doesn't grant that none unspectable fields like "is_admin" will be injected?
Thanks a lot
You can. But, in this case, is_admin is fillable, too.
@@LaravelDaily Oh of course! Great job. Thank you!
is there a way to request a user re-authentification when he try to modify something important (with jetstream ?) thanks !
Use middleware class.
Laravel confirmed middleware. Which ask for password again and store confirmed session for few minutes.
I have a request for a video! How to deploy laravel on plesk. Keep struggling doing this. Cant migrste the database and I dont want to switch to a vps because i dont know how to configure a Mailserver :/
I don't recommend using shared hosting for any Laravel projects. Learn how to use vps, this is my advice.
8:40 bug introduced, $user->is_donor = $request->blood_donor;
blood_donor key must've contained a boolean value.
can i send project to review, the project by laravel and laravel-mix vue, vuex, vue route ?
the project is user dashboard wit sanctum api auth
Sorry, currently I have already a long list of projects to review. Maybe in a few months.
@@LaravelDaily ok Thanks a lot for this videos, it's very helpful
Share the git link of the code, please.
I don't have a permission to do that, it's not my code.
what is this IDE please ?
PHPStorm
Please Sir Laravel Daily make a video course Chat. Laravel8 + Vue 3 or React + pusher (websockets) + Restfull api + jwt etc
I would take it for 200 dollars (Or any other price) or more. I want to become a developer and master everything
Template chatvia -> themeforest
I don't like data 🤣🤣
Thanks teacher