mirror of
https://github.com/flucont/btcloud.git
synced 2025-10-18 09:23:53 +00:00
update
This commit is contained in:
19
app/middleware/CheckAdmin.php
Normal file
19
app/middleware/CheckAdmin.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\middleware;
|
||||
|
||||
|
||||
class CheckAdmin
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
if (!request()->islogin) {
|
||||
if ($request->isAjax() || !$request->isGet()) {
|
||||
return json(['code'=>-1, 'msg'=>'未登录'])->code(401);
|
||||
}
|
||||
return redirect((string)url('/admin/login'));
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user