mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
29 lines
579 B
PHP
29 lines
579 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
use App\Models\User;
|
||
|
|
||
|
class Server
|
||
|
{
|
||
|
/**
|
||
|
* Handle an incoming request.
|
||
|
*
|
||
|
* @param \Illuminate\Http\Request $request
|
||
|
* @param \Closure $next
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function handle($request, Closure $next)
|
||
|
{
|
||
|
$token = $request->input('token');
|
||
|
if (empty($token)) {
|
||
|
abort(500, 'token is null');
|
||
|
}
|
||
|
if ($token !== config('v2board.server_token')) {
|
||
|
abort(500, 'token is error');
|
||
|
}
|
||
|
return $next($request);
|
||
|
}
|
||
|
}
|