Skip to content
8bityard
8bityard
  • Laravel
  • WordPress
  • PHP
  • Html
  • Bootstrap
  • J query
  • Tools
    • Word Counter
8bityard
8bityard
  • About
  • Contact
  • Portfolio
  • Post
  • Privacy Policy
  • Terms and Conditions
  • Welcome to 8bityard

How to get current user details in Laravel ?

/ Laravel / By Gaurav Pandey

In this article, we will learn how to get current user details using auth helper in laravel application, there are many ways to get current login user data.

At first, we know some basic details about Auth in laravel.

What is Auth :

Authentication is the process of identifying the user credentials. In laravel applications, laravel framework already provides auth for authentication, Authentication is managed by sessions that take the input parameters such as email or username, password, and google Id.

using Auth Facade we can easily get current Login user details.

Let’s see an Example :

Here, we have a user controller where we need some parameters of the current login user.

    public function userDashboard()
    {
        $AuthData = Auth::user();
        dd($AuthData);
        return view('Frontend.user.dashboard');
    }

This will work in your controller , but you have to include it :

use Illuminate\Support\Facades\Auth;

Now, you can pull what you want.

Here we can get all the parameters.
$AuthData->id;
$AuthData->name;
$AuthData->email;
$AuthData->role;

Output :

How to get current user details in Laravel
How to get current user details in Laravel
Note :

You can use using Auth Facade in mostly all laravel 5.6,5.8, 7, and 8 versions.

In this article, we learned “How to get current user details in Laravel”, I hope this article will help you with your Laravel Application Project.

Also Read : How to Insert Data using Ajax in Laravel.

Gaurav Pandey

Hi, My name is Gaurav Pandey. I'm a Laravel developer, owner of 8Bityard. I live in Uttarakhand - India and I love to write tutorials and tips that can help other developers. I am a big fan of PHP, Javascript, JQuery, Laravel, WordPress. connect@8bityard.com

Post navigation
← Previous Post
Next Post →

Related Posts

Laravel 5.8 CRUD (Create Read Update Delete) Tutorial For Beginners

Laravel

How to quickly generate data using faker and tinker ?

Laravel

How to create database seeder in Laravel 5.8 ?

Laravel

The Smart Way To Handle Request Validation In Laravel 5.8 (Laravel form validation)

Laravel

Recent Posts

  • Livewire Multiple Image Remove While UploadingFebruary 8, 2023
  • How to store multiple checkbox values in the database using Livewire?January 31, 2023
  • Accept only Gmail ID while registering in LivewireJanuary 12, 2023
  • Storage link already exists in LaravelDecember 31, 2022
  • Update Status using the toggle switch in LivewireDecember 29, 2022
  • Indian State, City SQL Database in LaravelDecember 23, 2022
  • JSON Encode and Decode in Livewire applicationDecember 21, 2022
  • Sweetalert2 delete confirmation in Livewire ExampleDecember 19, 2022
  • About
  • Portfolio
  • Privacy Policy
  • Terms and Conditions
  • Post
  • Contact

Copyright © 2022 8Bityard