Completed
Push — master ( f02869...8251a6 )
by Nicolas
03:31
created

AsgardInstalledMiddleware::handle()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php namespace Modules\Core\Http\Middleware;
2
3
use Closure;
4
use Illuminate\Http\Request;
5
use Illuminate\Support\Facades\Schema;
6
7
class AsgardInstalledMiddleware
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param  Request    $request
13
     * @param  Closure    $next
14
     * @return mixed
15
     * @throws \Exception
16
     */
17
    public function handle($request, Closure $next)
18
    {
19
        if (!file_exists(base_path('.env')) || !Schema::hasTable('users')) {
20
            throw new \Exception('Asgard is not yet installed');
21
        }
22
23
        return $next($request);
24
    }
25
}
26