Last active
December 19, 2017 05:02
-
-
Save rfmeier/fc292e83661ed0c6d2bedf15d31103e6 to your computer and use it in GitHub Desktop.
Get the current User in Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$is_authenticated = Auth::check(); | |
$is_guest = Auth::guest(); | |
// Using Auth facade | |
$user = Auth::user(); | |
// Using auth() helper | |
$user = auth()->user(); | |
// From a Request | |
$user = $request->user(); | |
// From Illuminate\Contracts\Auth\Guard | |
$user = $guard->user(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment