Passed
Branch main (b90ec4)
by Thierry
20:23 queued 14:04
created

IndexController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\View\View;
6
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
7
use Siak\Tontine\Service\LocaleService;
8
use Siak\Tontine\Service\Tontine\TontineService;
9
10
use function auth;
11
use function view;
12
13
class IndexController extends Controller
14
{
15
    /**
16
     * Show the home page.
17
     *
18
     * @param TontineService $tontineService
19
     *
20
     * @return View
21
     */
22
    public function index(TontineService $tontineService): View
23
    {
24
        view()->share([
25
            'user' => auth()->user(),
26
            'locales' => LaravelLocalization::getSupportedLocales(),
27
            'locale' => LaravelLocalization::getCurrentLocale(),
28
            'localeNative' => LaravelLocalization::getCurrentLocaleNative(),
29
            'hasGuestOrganisations' => $tontineService->hasGuestOrganisations()
30
        ]);
31
32
        return view("tontine::base.home");
33
    }
34
35
    /**
36
     * Show the user profile page.
37
     *
38
     * @param LocaleService $localeService
39
     *
40
     * @return View
41
     */
42
    public function profile(LocaleService $localeService): View
43
    {
44
        view()->share([
45
            'user' => auth()->user(),
46
            'locales' => LaravelLocalization::getSupportedLocales(),
47
            'locale' => LaravelLocalization::getCurrentLocale(),
48
            'localeNative' => LaravelLocalization::getCurrentLocaleNative(),
49
        ]);
50
51
        return view("tontine::base.profile", [
52
            'countries' => $localeService->getCountries(),
53
        ]);
54
    }
55
}
56