use Auth;
$user_id = Auth::user()->id;
$id = Auth::user()->id;print_r($id);
{{ auth()->user()->email }}
{{Auth::user()->username}}
$userId = Auth::id();
// Get the currently authenticated user's ID...
$id = Auth::id();
composer require laravel/ui
php artisan ui vue --auth
npm install && npm run dev
Laravel's laravel/ui package provides a quick way to scaffold all of the routes and views you need for authentication using a few simple commands:
composer require laravel/ui
php artisan ui vue --auth
Auth::user();
use IlluminateSupportFacadesAuth;
// Retrieve the currently authenticated user...
$user = Auth::user();
// Retrieve the currently authenticated user's ID...
$id = Auth::id();
auth()->id()
// Only for laravel 6.x and higher
composer require laravel/ui "^1.0" --dev
php artisan ui vue --auth
//namespace
use IlluminateSupportFacadesAuth;
// Laravel 5.x
php artisan make:auth
composer require laravel/ui:^2.4
php artisan ui vue --auth
use IlluminateSupportFacadesAuth;
Auth::login($user);
use Auth;
//find auth
function __construct()
{
$this->middleware('auth');
}
//end find auth
Route::get('/flights', function () {
// Only authenticated users may access this route...
})->middleware('auth:admin');