|
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"); |
|
|
|
|
|
|
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
|
|
|
$extraInfo = $accountModel->getExtraInfo(Auth::user()->id,100); |
|
32
|
|
|
return view("account.dashboard", [ |
|
33
|
|
|
'page_title'=>"DashBoard", |
|
34
|
|
|
'site_title'=>"NOJ", |
|
35
|
|
|
'navigation'=>"DashBoard", |
|
36
|
|
|
'info'=>$info, |
|
37
|
|
|
'userView'=>false, |
|
38
|
|
|
'settingView' => false, |
|
39
|
|
|
'feed'=>$feed, |
|
40
|
|
|
'extra_info' => $extraInfo |
|
41
|
|
|
]); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function settings() |
|
45
|
|
|
{ |
|
46
|
|
|
$accountModel=new AccountModel(); |
|
47
|
|
|
$info=$accountModel->detail(Auth::user()->id); |
|
48
|
|
|
if(!empty(session('last_email_send'))){ |
|
49
|
|
|
$email_cooldown = 300 - (time() - session('last_email_send')); |
|
50
|
|
|
} |
|
51
|
|
|
$extraInfo = $accountModel->getExtraInfo(Auth::user()->id,100); |
|
52
|
|
|
return view("account.dashboard", [ |
|
53
|
|
|
'page_title'=>"Setting", |
|
54
|
|
|
'site_title'=>"NOJ", |
|
55
|
|
|
'navigation'=>"Setting", |
|
56
|
|
|
'info'=>$info, |
|
57
|
|
|
'userView'=>false, |
|
58
|
|
|
'settingView' => true, |
|
59
|
|
|
'email_cooldown' => $email_cooldown ?? null, |
|
60
|
|
|
'extra_info' => $extraInfo |
|
61
|
|
|
]); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|