ProductbacklogMiddleware::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
namespace GitScrum\Http\Middleware;
4
5
use Closure;
6
use Auth;
7
8
class ProductbacklogMiddleware
9
{
10
    /**
11
      * Handle an incoming request.
12
      *
13
      * @param \Illuminate\Http\Request $request
14
      * @param \Closure                 $next
15
      *
16
      * @return mixed
17
      */
18
     public function handle($request, Closure $next)
19
     {
20
         $total = Auth::user()->organizations()->count();
21
22
         if (!$total) {
23
             return redirect()->route('wizard.step1');
24
         }
25
26
         return $next($request);
27
     }
28
}
29