RedirectIfInstalled::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
7
class RedirectIfInstalled
8
{
9
    const INSTALLATION_FILE = 'install.lock';
10
11
    /**
12
     * Handle an incoming request.
13
     *
14
     * @param  \Illuminate\Http\Request $request
15
     * @param  \Closure $next
16
     * @return mixed
17
     */
18
    public function handle($request, Closure $next)
19
    {
20
        // Installation lock disabled, we can't run the install process anymore
21
        if (!file_exists(base_path() . '/' . self::INSTALLATION_FILE)) {
22
            return redirect('/');
23
        }
24
25
        return $next($request);
26
    }
27
}
28