
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
- Get comma separated email from input array
- How to customize pagination view in laravel
- Laravel order by date not working
- How to get tomorrow and yesterday date in laravel
- Method Illuminate\Http\Request::validated does not exist
- How to fetch single row data from database in laravel
- Generate unique username in Laravel
- How to prevent host header attack in Laravel
- Run artisan command to generate key in laravel
- Create a record if not exist in laravel
- How to return error message from controller to view in laravel
- How to add script on specific view file in laravel while extending layout
- How to insert multiple rows in mysql using loop in laravel?
- How to get IP address in laravel
- Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found
- How to pass query string with pagination in laravel
- Route prefix with auth middleware in laravel
- How to get the id of last record from collection object in laravel view
- 419 page expired error in Laravel
- How to create and run user seeder in laravel
- How to add foreign key in laravel using migration
- Laravel create default admin user
- How to delete record in Laravel with ajax
- How to implement toggleLike() method in Overtrue\LaravelLike laravel package
- Import/Use Storage facade in laravel