Get Current login Auth user details using Laravel 5.7

Today, We want to share with you Get Current login Auth user details using Laravel 5.7.In this post we will show you laravel 5.6 get current user, hear for Laravel 5.5 get current login user details using Auth we will give you demo and example for implement.In this post, we will learn about PHP Laravel 5.7 get current user details with an example.

Get Current login Auth user details using Laravel 5.7

There are the Following The simple About Get Current login Auth user details using Laravel 5.7 Full Information With Example and source code.

Read Also:  Axios Post Request in vue.js

As I will cover this Post with live Working example to develop laravel 5.7 get current user, so the some laravel auth :: user () returning null for this example is following below.

class ‘app\http\controllers\auth’ not found
Class ‘App\Http\Controllers\Auth’ not found -FatalErrorException in HomeController.php

in the top of the controller.

use Auth; 

Example 1: Using Laravel Helper:

Get Logged User Data using helper

$get_user_dtl = auth()->user();
dd($get_user_dtl->id);
dd($get_user_dtl->name);
dd($get_user_dtl->email);

Example 2: Using Facade:

you can get all the login user information using Laravel Auth facade, it will also return object of current users data.

Read Also:  PHP Image Rotate Resize and Save Examples

$get_user_dtl = Auth::user();
dd($get_user_dtl->id);
dd($get_user_dtl->name);
dd($get_user_dtl->email);

Using the Auth to get current user data

use Illuminate\Support\Facades\Auth;

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

$user = \Auth::user();
$user = Auth::user();

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

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

I hope you get an idea about Get Current login Auth user details using Laravel 5.7.
I would like to have feedback on my Pakainfo.com 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.