
How to display user profile after login in laravel
How to display user profile after login in laravel
In this tutorial, we will try to find the solution to "How to display user profile after login in laravel" through programming.
You can display user profile after login in laravel. You can get the user details using the Auth::user() helper function which you can call in the blade file.-
Display user details in view file after login
--PATH resources\views\<home>.blade.php//Display name of authenticated user {{ Auth::user()->name }} //Get logged in user id {{ Auth::user()->id }} //Display logged in user image @if( isset(Auth::user()->image) && file_exists('storage/'.Auth::user()->image)) <img src="{{ asset('storage/'.Auth::user()->image) }}" alt="{{ Auth::user()->image }}"> @else <img src="{{ asset('frontend/images/imagenotfound.jpg') }}" alt="..."> @endif
Auth::user() will work only if the user is authenticated/logged in else it will give an error. To display the image you have to link the storage folder and check if the file exists in /storage/{user_profile}.jpg and display using asset method.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- Run artisan command to generate key in laravel
- Get comma separated email from input array
- Class 'App\Http\Controllers\User' not found
- How to create pivot table in laravel using migration
- How to use more than one query scope in Laravel
- Laravel save object to database
- Symlink(): No such file or directory
- How to display order by null last in laravel
- How to get last month records in Laravel
- Eager loading dynamically in laravel
- Call to undefined method App\Models\User::follow()
- Rename Pivot Table in Laravel
- How to pass data to partial view file in laravel
- How to display pivot table column value in laravel
- Store logged in user details in session and display in view in laravel
- On delete set foreign id column value null using migration in laravel 8
- Target class [admin] does not exist.
- Check if Relationship Method Exists in Laravel
- How to get count of all records created at yesterday
- How to pass two variables in HREF in laravel
- How to fill a column automatically while creating records in Laravel
- Laravel recursive function in controller
- Laravel create table migration with model
- How to get database name in Laravel 9 ?
- The Pusher library requires the PHP cURL module. Please ensure it is installed