mirror of
https://github.com/easychen/pushdeer.git
synced 2024-11-16 15:29:21 +08:00
26 lines
572 B
PHP
26 lines
572 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
|
|
class EnsureMember
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle(Request $request, Closure $next)
|
|
{
|
|
if (!isset($_SESSION) || !isset($_SESSION['level']) || $_SESSION['level'] < 1) {
|
|
return send_error("当前用户没有足够的权限访问此接口", ErrorCode('AUTH'));
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|