<?php
Laravel auth check login
use Illuminate\Support\Facades\Auth;
if (Auth::check()) {
// The user is logged in...
}
use Auth;
//find auth
function __construct()
{
$this->middleware('auth');
}
//end find auth
Laravel auth helper function
// How to install Auth in laravel
// With Boothstrap
composer require laravel/ui --dev
php artisan ui bootstrap --auth
npm install && npm run dev
// With VUE
composer require laravel/ui --dev
php artisan ui vue --auth
npm install && npm run dev
composer require laravel/ui "^1.0" --dev
php artisan ui vue --auth
laravel auth user in constructor
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::user();
return $next($request);
});
}
laravel auth helper function
$user = auth()->user();
0 comments:
Post a Comment
Thanks