我正在使用Laravel5。我在/ public / plugins / ckfinder目录中有引用ckfinder的文件夹。
我需要使用config.php中的CheckAuthentication函数,但是会话值和Auth Class为null。
我试过了
function CheckAuthentication(){
return Auth::check();
}
Run Code Online (Sandbox Code Playgroud)
要么
//Ckfinder Config.php
function CheckAuthentication(){
if($_SESSION['ckfinder_enabled'] == 'enabled') {
return true;
} else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
//App\Http\Middleware\Authenticate.php
public function handle($request, Closure $next)
{
if ($this->auth->guest()){
if ($request->ajax()){
return response('Unauthorized.', 401);
}else{
return redirect()->guest('auth/login');
}
}
if($this->auth->check()) {
$_SESSION['ckfinder_enabled'] = 'enabled';
return $next($request);
}
}
Run Code Online (Sandbox Code Playgroud)