Exemplo n.º 1
0
 /**
  * @param \Request $request
  * @param callable $next
  * @return mixed
  * @throws DeepInException
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->input("project_id", null);
     if (empty($projectId)) {
         throw new DeepInException("projectId不能为空~!");
     }
     $token = $request->input("token", null);
     if (empty($token)) {
         throw new DeepInException("token不能为空~!");
     }
     $project = Project::find($projectId);
     if (!$project instanceof Project) {
         throw new DeepInException("错误的project_id");
     }
     $this->checkAccess($project, $request->getClientIp());
     $this->checkToken($token, $project);
     return $next($request);
 }