blessing-skin-server/app/Http/Middleware/CheckAdminMiddleware.php

22 lines
474 B
PHP
Raw Normal View History

2016-08-28 10:05:21 +08:00
<?php
namespace App\Http\Middleware;
class CheckAdminMiddleware
{
public function handle($request, \Closure $next)
{
$user = (new CheckAuthenticated)->handle($request, $next, true);
2016-08-29 23:08:09 +08:00
if ($user instanceof \Illuminate\Http\RedirectResponse) {
return $user;
}
2016-08-28 10:05:21 +08:00
if (!$user->is_admin) {
2016-08-29 23:08:09 +08:00
return redirect('user')->with('msg', '看起来你并不是管理员哦');
2016-08-28 10:05:21 +08:00
}
return $next($request);
}
}