laravel blade auth check
@guest
// Show content if unauthenticated
@endguest
@auth
// The data only available for auth user
@endauth
laravel blade auth check
@guest
// Show content if unauthenticated
@endguest
@auth
// The data only available for auth user
@endauth
laravel get auth user in constructor
<?php
namespace AppHttpControllers;
use AppUser;
use IlluminateSupportFacadesAuth;
use AppHttpControllersController;
class ProjectController extends Controller
{
/**
* All of the current user's projects.
*/
protected $projects;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->projects = Auth::user()->projects;
return $next($request);
});
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us