<?php
namespace App\Http\Middleware;
use App\Http\Controllers\Service\v1\AreaService;
use App\Http\Controllers\Service\v1\AuthService;
use App\Http\Controllers\Service\v1\OauthService;
use App\Http\Controllers\Service\v1\RoleService;
use App\Http\Controllers\Service\v1\UserService;
use App\Http\Controllers\Utils\RedisClient;
use Closure;
use Illuminate\Http\Request;
class Base
{
protected $userService;
protected $oauthService;
protected $roleService;
protected $ruleService;
protected $areaService;
protected $redisClient;
protected $post;
public function __construct(Request $request)
{
$this->userService = UserService::getInstance();
$this->oauthService = OauthService::getInstance();
$this->roleService = RoleService::getInstance();
$this->ruleService = AuthService::getInstance();
$this->redisClient = RedisClient::getInstance();
$this->areaService = AreaService::getInstance();
$this->post = $request->post();
}
public function handle(Request $request, Closure $next)
{
if ($request->getMethod() === 'GET') {
setCode(405);
exit();
}
if (empty($this->post['token'])) {
setCode(403);
exit();
}
}
}