Passed
Push — main ( ea0813...90e5be )
by Thierry
08:59 queued 04:05
created

IndexController::profile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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