Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

semour / semour_web

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Find file
Normal viewHistoryPermalink
Switch branch/tag
  • semour_web
  • app
  • Http
  • Middleware
  • CheckApiLogin.php
CheckApiLogin.php 628 Bytes
杨树贤's avatar
重置秘密和邮箱相关接口
1a52f4a5
 
杨树贤 committed 2 years ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?php

namespace App\Http\Middleware;

use App\Http\ApiHelper\Response;
use Closure;

class CheckApiLogin
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (!\Auth::check()) {
            $response = [
                'code' => 1,
                'msg' => 'need login...',
            ];
            return response()->json($response);
杨树贤's avatar
独立出请求验证
0c1b982d
 
杨树贤 committed 2 years ago
25 26
        } else {
            $request->user = \Auth::user();
杨树贤's avatar
重置秘密和邮箱相关接口
1a52f4a5
 
杨树贤 committed 2 years ago
27 28 29 30
            return $next($request);
        }
    }
}