authentication - Laravel: Dependency Inject Auth -



authentication - Laravel: Dependency Inject Auth -

how dependency inject auth in laravel?

like this:

public function __construct(auth $auth) { $this->auth = $auth; }

if not work:

$user_type = auth::user()->user_type;

you should type hint illuminate\auth\authmanager:

public function __construct(illuminate\auth\authmanager $auth) { $this->auth = $auth; }

authentication laravel laravel-4 dependency-injection

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -