Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel controller constructor auth user null

class BaseController extends Controller
{
    public $user_info;
  
    public function __construct(){
      $this->middleware(function ($request, $next) {
        $this->user_info=Auth::user(); // returns user
        return $next($request);
      });
    }
}
 
PREVIOUS NEXT
Tagged: #laravel #controller #constructor #auth #user #null
ADD COMMENT
Topic
Name
5+8 =