{{ auth()->user()->email }}
{{Auth::user()->username}}
$userId = 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();
// 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);
composer require laravel/ui "^2.0"
Route::get('/flights', function () {
// Only authenticated users may access this route...
})->middleware('auth:admin');
protected $guards = [];
public function handle($request, Closure $next, ...$guards)
{
$this->guards = $guards;
return parent::handle($request, $next, ...$guards);
}
protected function redirectTo($request)
{
if (in_array("admin", $this->guards)) {
return "admin/login";
}
}