Passed
Pull Request — master (#90)
by
unknown
05:43
created

AccountController::setting()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 12
nc 2
nop 0
dl 0
loc 15
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use App\Models\AccountModel;
7
use Auth;
8
9
class AccountController extends Controller
10
{
11
    /**
12
     * Show the account index.
13
     *
14
     * @return \Illuminate\View\View
15
     */
16
    public function index()
17
    {
18
        return Auth::check() ? redirect("/account/dashboard") : redirect("/login");
0 ignored issues
show
Bug Best Practice introduced by
The expression return Auth::check() ? r...') : redirect('/login') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\View\View.
Loading history...
19
    }
20
21
    /**
22
     * Show the account dashboard.
23
     *
24
     * @return \Illuminate\View\View
25
     */
26
    public function dashboard()
27
    {
28
        $accountModel=new AccountModel();
29
        $info=$accountModel->detail(Auth::user()->id);
30
        $feed=$accountModel->feed(Auth::user()->id);
31
        return view("account.dashboard", [
32
            'page_title'=>"DashBoard",
33
            'site_title'=>"NOJ",
34
            'navigation'=>"DashBoard",
35
            'info'=>$info,
36
            'userView'=>false,
37
            'settingView' => false,
38
            'feed'=>$feed
39
        ]);
40
    }
41
42
    public function setting()
43
    {
44
        $accountModel=new AccountModel();
45
        $info=$accountModel->detail(Auth::user()->id);
46
        if(!empty(session('last_email_send'))){
47
            $email_cooldown = 300 - (time() - session('last_email_send'));
48
        }
49
        return view("account.dashboard", [
50
            'page_title'=>"Setting",
51
            'site_title'=>"NOJ",
52
            'navigation'=>"Setting",
53
            'info'=>$info,
54
            'userView'=>false,
55
            'settingView' => true,
56
            'email_cooldown' => $email_cooldown ?? null,
57
        ]);
58
    }
59
}
60