I am newbie to laravel. I have question in my mind that... Is it right way to show all user information using auth::guard. I am using laravel breeze authentication ?
for ex. is it right -
name: Auth::guard('web')->user()->name
mobile: Auth::guard('web')->user()->mobile
address: Auth::guard('web')->user()->address
city: Auth::guard('web')->user()->city
gender: Auth::guard('web')->user()->gender
like this ?
This would work but might more commonly be written like this. If you are sure your user is logged in, then you skip any additional check of $user.
If your user might not be logged in, this you can add line specific checks like this:
If your user might not be logged in and you want to ensure they always are, you can do this: