| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php namespace App\Http\Controllers; |
||
| 13 | public function index(Request $request) |
||
| 14 | { |
||
| 15 | if (app('translator')->getLocale() == config('app.locale') && app('translator')->getLocale() != $request->segment(1)) { |
||
| 16 | return redirect(app('translator')->getLocale()); |
||
| 17 | } |
||
| 18 | |||
| 19 | $name = trans('auth.guest'); |
||
| 20 | $userType = self::TRANSLATION_TAG_GUEST_USER; |
||
| 21 | |||
| 22 | /** @var \App\Models\User $user */ |
||
| 23 | if ($user = app('auth.driver')->user()) { |
||
| 24 | $name = $user->name; |
||
| 25 | $userType = self::TRANSLATION_TAG_REGISTERED_USER; |
||
| 26 | } |
||
| 27 | |||
| 28 | return view('index', ['userType' => $userType, 'name' => $name]); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |