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 response()->redirectTo("/account/dashboard"); |
|
|
|
|
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->getExtra(Auth::user()->id, ['gender', 'contanct', 'school', 'country', 'location'],100); |
32
|
|
|
$socialiteInfo = $accountModel->getSocialiteInfo(Auth::user()->id,100); |
33
|
|
|
return view("account.dashboard", [ |
34
|
|
|
'page_title'=>"DashBoard", |
35
|
|
|
'site_title'=>config("app.name"), |
36
|
|
|
'navigation'=>"DashBoard", |
37
|
|
|
'info'=>$info, |
38
|
|
|
'userView'=>false, |
39
|
|
|
'settingsView' => false, |
40
|
|
|
'feed'=>$feed, |
41
|
|
|
'extra_info' => $extraInfo, |
42
|
|
|
'socialite_info' => $socialiteInfo, |
43
|
|
|
]); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Show the account dashboard. |
48
|
|
|
* |
49
|
|
|
* @return \Illuminate\View\View |
50
|
|
|
*/ |
51
|
|
|
public function settings() |
52
|
|
|
{ |
53
|
|
|
$accountModel=new AccountModel(); |
54
|
|
|
$info=$accountModel->detail(Auth::user()->id); |
55
|
|
|
if(!empty(session('last_email_send'))){ |
56
|
|
|
$email_cooldown = 300 - (time() - session('last_email_send')); |
57
|
|
|
} |
58
|
|
|
$extraInfo = $accountModel->getExtra(Auth::user()->id, ['gender', 'contanct', 'school', 'country', 'location'],100); |
59
|
|
|
$socialiteInfo = $accountModel->getSocialiteInfo(Auth::user()->id,100); |
60
|
|
|
return view("account.dashboard", [ |
61
|
|
|
'page_title'=>"Settings", |
62
|
|
|
'site_title'=>config("app.name"), |
63
|
|
|
'navigation'=>"Settings", |
64
|
|
|
'info'=>$info, |
65
|
|
|
'userView'=>false, |
66
|
|
|
'settingsView' => true, |
67
|
|
|
'email_cooldown' => $email_cooldown ?? null, |
68
|
|
|
'extra_info' => $extraInfo, |
69
|
|
|
'socialite_info' => $socialiteInfo, |
70
|
|
|
]); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|