Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function handle($request, Closure $next) |
||
17 | { |
||
18 | // Here we can perform an multi tenant required authentication |
||
19 | if (!\Auth::check()) { |
||
20 | return redirect('/login'); |
||
21 | } |
||
22 | |||
23 | // Assign the user to a tenant if we have one |
||
24 | if (\Auth::user()->owns()->count() == 1) { |
||
25 | session()->put('tenant', [ |
||
26 | 'id' => \Auth::user()->owns()->first()->id |
||
27 | ]); |
||
28 | } |
||
29 | |||
30 | return $next($request); |
||
31 | } |
||
32 | } |
||
33 |