mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
22 lines
446 B
PHP
22 lines
446 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
class CheckAdministrator
|
|
{
|
|
public function handle($request, \Closure $next)
|
|
{
|
|
$result = (new CheckAuthenticated)->handle($request, $next, true);
|
|
|
|
if ($result instanceof \Illuminate\Http\RedirectResponse) {
|
|
return $result;
|
|
}
|
|
|
|
if (! $result->isAdmin()) {
|
|
abort(403, trans('auth.check.admin'));
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|