IndexController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * IndexController.php
4
 * Copyright (c) 2020 [email protected].
5
 *
6
 * This file is part of the Firefly III bunq importer
7
 * (https://github.com/firefly-iii/bunq-importer).
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
21
 */
22
23
declare(strict_types=1);
24
25
namespace App\Http\Controllers;
26
27
use Illuminate\Contracts\View\Factory;
28
use Illuminate\Http\RedirectResponse;
29
use Illuminate\Routing\Redirector;
30
use Illuminate\Support\Facades\Artisan;
31
use Illuminate\View\View;
32
33
/**
34
 * Class IndexController.
35
 */
36
class IndexController extends Controller
37
{
38
    /**
39
     * IndexController constructor.
40
     */
41
    public function __construct()
42
    {
43
        parent::__construct();
44
        app('view')->share('pageTitle', 'Index');
45
    }
46
47
    /**
48
     * @return RedirectResponse|Redirector
49
     */
50
    public function flush()
51
    {
52
        app('log')->debug(sprintf('Now at %s', __METHOD__));
53
        session()->flush();
54
        Artisan::call('cache:clear');
55
        Artisan::call('config:clear');
56
57
        return redirect(route('index'));
58
    }
59
60
    /**
61
     * @return Factory|View
62
     */
63
    public function index()
64
    {
65
        app('log')->debug('If you see this, debug logging is configured correctly.');
66
67
        return view('index');
68
    }
69
}
70