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

AsgardInstalledMiddleware   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 3
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