1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
6
|
|
|
use App\Models\AccountModel; |
7
|
|
|
use App\Models\Eloquent\UserExtra; |
8
|
|
|
use App\Models\Eloquent\Tool\Socialite; |
9
|
|
|
use Auth; |
10
|
|
|
|
11
|
|
|
class AccountController extends Controller |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* Show the account index. |
15
|
|
|
* |
16
|
|
|
* @return \Illuminate\View\View |
17
|
|
|
*/ |
18
|
|
|
public function index() |
19
|
|
|
{ |
20
|
|
|
return response()->redirectTo("/account/dashboard"); |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Show the account dashboard. |
25
|
|
|
* |
26
|
|
|
* @return \Illuminate\View\View |
27
|
|
|
*/ |
28
|
|
|
public function dashboard() |
29
|
|
|
{ |
30
|
|
|
$accountModel=new AccountModel(); |
31
|
|
|
$info=$accountModel->detail(Auth::user()->id); |
|
|
|
|
32
|
|
|
$feed=$accountModel->feed(Auth::user()->id); |
33
|
|
|
$extraInfo=Auth::user()->getExtra(['gender', 'contact', 'school', 'country', 'location'], 100); |
|
|
|
|
34
|
|
|
$socialiteInfo=Auth::user()->getSocialiteInfo(100); |
|
|
|
|
35
|
|
|
return view("account.dashboard", [ |
36
|
|
|
'page_title'=>"DashBoard", |
37
|
|
|
'site_title'=>config("app.name"), |
38
|
|
|
'navigation'=>"DashBoard", |
39
|
|
|
'info'=>$info, |
40
|
|
|
'userView'=>false, |
41
|
|
|
'settingsView' => false, |
42
|
|
|
'feed'=>$feed, |
43
|
|
|
'extra_info' => $extraInfo, |
44
|
|
|
'extraDict' => UserExtra::$extraDict, |
45
|
|
|
'socialite_info' => $socialiteInfo, |
46
|
|
|
'socialites' => Socialite::getAvailable(), |
47
|
|
|
]); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Show the account dashboard. |
52
|
|
|
* |
53
|
|
|
* @return \Illuminate\View\View |
54
|
|
|
*/ |
55
|
|
|
public function settings() |
56
|
|
|
{ |
57
|
|
|
$accountModel=new AccountModel(); |
58
|
|
|
$info=$accountModel->detail(Auth::user()->id); |
|
|
|
|
59
|
|
|
if (!empty(session('last_email_send'))) { |
60
|
|
|
$email_cooldown=300-(time()-session('last_email_send')); |
61
|
|
|
} |
62
|
|
|
$extraInfo=Auth::user()->getExtra(['gender', 'contact', 'school', 'country', 'location'], 100); |
63
|
|
|
$socialiteInfo=Auth::user()->getSocialiteInfo(100); |
64
|
|
|
return view("account.dashboard", [ |
65
|
|
|
'page_title'=>"Settings", |
66
|
|
|
'site_title'=>config("app.name"), |
67
|
|
|
'navigation'=>"Settings", |
68
|
|
|
'info'=>$info, |
69
|
|
|
'userView'=>false, |
70
|
|
|
'settingsView' => true, |
71
|
|
|
'email_cooldown' => $email_cooldown ?? null, |
72
|
|
|
'extra_info' => $extraInfo, |
73
|
|
|
'extraDict' => UserExtra::$extraDict, |
74
|
|
|
'socialite_info' => $socialiteInfo, |
75
|
|
|
'socialites' => Socialite::getAvailable(), |
76
|
|
|
]); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|