Conditions | 6 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 6.5625 |
Changes | 3 | ||
Bugs | 2 | Features | 0 |
1 | <?php |
||
33 | 63 | public function handle(Request $request, Closure $next) |
|
34 | { |
||
35 | 63 | $siteDown = $this->app->isDownForMaintenance(); |
|
36 | 63 | $isLogin = $request->is('/', 'logout', 'signin'); |
|
37 | |||
38 | // Allow admin & login page to always view the site event in maintenance mode |
||
39 | 63 | if ($siteDown && !$isLogin && ($this->auth->guest() || !$this->getLoggedUser()->isAdmin())) { |
|
40 | throw new HttpException(503); |
||
41 | } |
||
42 | |||
43 | // Show message to administrator |
||
44 | 63 | if ($siteDown) { |
|
45 | $this->app['session']->flash('notice-error', trans('tinyissue.site_maintenance_message')); |
||
46 | } |
||
47 | |||
48 | 63 | return $next($request); |
|
49 | } |
||
50 | } |
||
51 |