blessing-skin-server/app/Http/Middleware/CheckAdminMiddleware.php
2016-10-23 11:41:52 +08:00

22 lines
475 B
PHP

<?php
namespace App\Http\Middleware;
class CheckAdminMiddleware
{
public function handle($request, \Closure $next)
{
$user = (new CheckAuthenticated)->handle($request, $next, true);
if ($user instanceof \Illuminate\Http\RedirectResponse) {
return $user;
}
if (!$user->isAdmin()) {
return redirect('user')->with('msg', '看起来你并不是管理员哦');
}
return $next($request);
}
}