I want to use config::set
in my Middleware for the set the value globally. But it is generating error.
Below is the code which I am using
public function handle($request, Closure $next, $guard = 'admin') {
if (!Auth::guard($guard)->check()) {
return redirect('/admin/login');
}
//dd(Auth::guard('admin')->user()->id);
$admin = $this->admin->with('adminRole')->find(Auth::guard('admin')->user()->id);
config::set('bmc.admin_permission', $admin);
// check user roles
if (array_key_exists('0', $admin->adminRole) && isset($admin->adminRole[0]->name)) {
dd($admin->hasRole($admin->adminRole[0]->name));
}
return $next($request);
}
Here is the error which I get
Class 'App\Http\Middleware\config' not found
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire