Owner   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 3
1
<?php
2
namespace App\Http\Middleware;
3
4
use Closure;
5
use Auth;
6
7
class Owner
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @param  \Closure  $next
14
     * @return mixed
15
     */
16
    
17
    public function handle($request, Closure $next,$permissions)
18
    {
19
        if (!Auth::User()->can($permissions)) 
20
        {
21
            if (Auth::User()->id != $request->route('user_id')) 
22
            {
23
                abort(403);
24
            }
25
        }
26
       
27
        return $next($request);
28
    }
29
}
30