Skip to main content

Laravel 5.7 Get Current UserId UserName and Email

Today, We want to share with you Laravel 5.7 Get Current UserId UserName and Email.In this post we will show you How to get current user details in Laravel 5.7, hear for Laravel 5.7 display logged in user name or email we will give you demo and example for implement.In this post, we will learn about Laravel Profile Login With Email Or Username Display with Edit with an example.

Laravel 5.7 Get Current UserId UserName and Email

There are the Following The simple About Laravel 5.7 Get Current UserId UserName and Email Full Information With Example and source code.

Also Read :  Multiple Image Upload using PHP into MYSQL database

As I will cover this Post with live Working example to develop Laravel Auth user id in controller, so the get current logged in user id in laravel 5.7 for this example is following below.

Laravel5.7 Get Auth User Information

Using Laravel Facade:

$get_user_details = Auth::user();

Using Laravel Helper:

$userDtl = auth()->user();

Simple You need to use the Auth facade in the Laravel controller;

use Auth;

<h3>laravel 5.7 get current user in controller</h3>
<p>Laravel 5.7 - get Auth user ID in controller with Fetch user data and display that data in Laravel Blade view files.</p>

<b>In Controller:</b>
public function profile()
    $userDtl = Auth::user();
    return view('home')->with(['userDtl' => $userDtl]);

Your Laravel Blade View

<h3>PHP Laravel 5.7 get current user details</h3>
<div class="panel-body">
    Profile user id is: {{ $userDtl->id }}
    Login User first name is: {{ $userDtl->first_name }}
    Login User last name is: {{ $userDtl->last_name }}

laravel 5.7 get id of logged in user

Get Logged User Data using Laravel 5.7 helper

$userInfo = auth()->user();

Get Laravel 5.7 Logged User ID using helper

$id = auth()->user()->id;

Laravel 5.7 Get Logged User Data using facade

$userInfo = Auth::user();

Get Logged User ID using Laravel facade

$user_id = Auth::user()->id;

Angular 6 CRUD Operations Application Tutorials

Read :

Also Read :  Get Current User ID from Mysql in Laravel


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 Get Current UserId UserName and Email.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Gondaliya Jaydeep

Hi, I’m Jaydeep Gondaliya, PHP is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]