Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function handle($request, Closure $next) |
||
20 | { |
||
21 | $subdomain = $request->route('subdomain'); |
||
22 | $tenant = app('rinvex.tenants.tenant')->where('slug', $subdomain)->first(); |
||
23 | |||
24 | if ($subdomain && ! $tenant) { |
||
25 | return intend([ |
||
26 | 'url' => route('guestarea.home'), |
||
27 | 'with' => ['warning' => trans('cortex/tenants::messages.tenant.not_found', ['tenantSlug' => $subdomain])], |
||
|
|||
28 | ]); |
||
29 | } |
||
30 | |||
31 | // unBind {subdomain} route parameter |
||
32 | ! $request->route('subdomain') || $request->route()->forgetParameter('subdomain'); |
||
33 | |||
34 | // Activate current tenant |
||
35 | ! $tenant || config(['rinvex.tenants.tenant.active' => $tenant]); |
||
36 | |||
37 | return $next($request); |
||
38 | } |
||
39 | } |
||
40 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.