@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
79 | 79 | ]); |
80 | 80 | |
81 | - foreach ((array) $request->json()->all() as $setting => $value) { |
|
81 | + foreach ((array)$request->json()->all() as $setting => $value) { |
|
82 | 82 | UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
83 | 83 | } |
84 | 84 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
146 | 146 | |
147 | - Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
147 | + Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName')]); |
|
148 | 148 | |
149 | 149 | return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
150 | 150 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | $partialName = explode(' ', (new Alliteration())->getName()); |
164 | 164 | |
165 | - return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
165 | + return strtolower($partialName[0] . strstr($userMail, '@', true) . $partialName[1]); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
212 | 212 | |
213 | 213 | Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
214 | - 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
214 | + 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName'), |
|
215 | 215 | ]); |
216 | 216 | |
217 | 217 | return response(null); |
@@ -1,41 +1,41 @@ discard block |
||
1 | -<?php |
|
2 | - |
|
3 | -namespace App\Http\Controllers; |
|
4 | - |
|
5 | -use App\Facades\Mail; |
|
6 | -use App\Facades\User as UserFacade; |
|
7 | -use App\Facades\Validation; |
|
8 | -use App\Models\ChocolateyId; |
|
9 | -use App\Models\User; |
|
10 | -use App\Models\UserPreferences; |
|
11 | -use App\Models\UserSettings; |
|
12 | -use Illuminate\Http\JsonResponse; |
|
13 | -use Illuminate\Http\Request; |
|
14 | -use Illuminate\Http\Response; |
|
15 | -use Illuminate\Support\Facades\Config; |
|
16 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
17 | -use Nubs\RandomNameGenerator\Alliteration; |
|
1 | + <?php |
|
2 | + |
|
3 | + namespace App\Http\Controllers; |
|
4 | + |
|
5 | + use App\Facades\Mail; |
|
6 | + use App\Facades\User as UserFacade; |
|
7 | + use App\Facades\Validation; |
|
8 | + use App\Models\ChocolateyId; |
|
9 | + use App\Models\User; |
|
10 | + use App\Models\UserPreferences; |
|
11 | + use App\Models\UserSettings; |
|
12 | + use Illuminate\Http\JsonResponse; |
|
13 | + use Illuminate\Http\Request; |
|
14 | + use Illuminate\Http\Response; |
|
15 | + use Illuminate\Support\Facades\Config; |
|
16 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
17 | + use Nubs\RandomNameGenerator\Alliteration; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Class AccountController. |
21 | 21 | */ |
22 | -class AccountController extends BaseController |
|
23 | -{ |
|
24 | - /** |
|
22 | + class AccountController extends BaseController |
|
23 | + { |
|
24 | + /** |
|
25 | 25 | * Save User Look. |
26 | 26 | * |
27 | 27 | * @param Request $request |
28 | 28 | * |
29 | 29 | * @return JsonResponse |
30 | 30 | */ |
31 | - public function saveLook(Request $request): JsonResponse |
|
32 | - { |
|
33 | - UserFacade::updateSession(['look' => $request->json()->get('figure'), 'gender' => $request->json()->get('gender')]); |
|
31 | + public function saveLook(Request $request): JsonResponse |
|
32 | + { |
|
33 | + UserFacade::updateSession(['look' => $request->json()->get('figure'), 'gender' => $request->json()->get('gender')]); |
|
34 | 34 | |
35 | - return response()->json(UserFacade::getUser()); |
|
36 | - } |
|
35 | + return response()->json(UserFacade::getUser()); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * Get User Non Read Messenger Discussions. |
40 | 40 | * |
41 | 41 | * @TODO: Code Integration with HabboMessenger |
@@ -43,59 +43,59 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return JsonResponse |
45 | 45 | */ |
46 | - public function getDiscussions(): JsonResponse |
|
47 | - { |
|
48 | - return response()->json([]); |
|
49 | - } |
|
46 | + public function getDiscussions(): JsonResponse |
|
47 | + { |
|
48 | + return response()->json([]); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
51 | + /** |
|
52 | 52 | * Get User Preferences. |
53 | 53 | * |
54 | 54 | * @return JsonResponse |
55 | 55 | */ |
56 | - public function getPreferences(): JsonResponse |
|
57 | - { |
|
58 | - $userPreferences = UserPreferences::firstOrCreate(['user_id' => UserFacade::getUser()->uniqueId]); |
|
56 | + public function getPreferences(): JsonResponse |
|
57 | + { |
|
58 | + $userPreferences = UserPreferences::firstOrCreate(['user_id' => UserFacade::getUser()->uniqueId]); |
|
59 | 59 | |
60 | - foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
61 | - $userPreferences->{$attributeName} = $attributeValue == 1; |
|
62 | - } |
|
60 | + foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
61 | + $userPreferences->{$attributeName} = $attributeValue == 1; |
|
62 | + } |
|
63 | 63 | |
64 | - return response()->json($userPreferences); |
|
65 | - } |
|
64 | + return response()->json($userPreferences); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
67 | + /** |
|
68 | 68 | * Save New User Preferences. |
69 | 69 | * |
70 | 70 | * @param Request $request |
71 | 71 | * |
72 | 72 | * @return Response |
73 | 73 | */ |
74 | - public function savePreferences(Request $request): Response |
|
75 | - { |
|
76 | - UserSettings::updateOrCreate(['user_id' => UserFacade::getUser()->uniqueId], [ |
|
77 | - 'block_following' => $request->json()->get('friendCanFollow') == false ? '1' : '0', |
|
78 | - 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
|
79 | - ]); |
|
74 | + public function savePreferences(Request $request): Response |
|
75 | + { |
|
76 | + UserSettings::updateOrCreate(['user_id' => UserFacade::getUser()->uniqueId], [ |
|
77 | + 'block_following' => $request->json()->get('friendCanFollow') == false ? '1' : '0', |
|
78 | + 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
|
79 | + ]); |
|
80 | 80 | |
81 | - foreach ((array) $request->json()->all() as $setting => $value) { |
|
82 | - UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
|
83 | - } |
|
81 | + foreach ((array) $request->json()->all() as $setting => $value) { |
|
82 | + UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
|
83 | + } |
|
84 | 84 | |
85 | - return response(null); |
|
86 | - } |
|
85 | + return response(null); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
88 | + /** |
|
89 | 89 | * Get All E-Mail Accounts. |
90 | 90 | * |
91 | 91 | * @return JsonResponse |
92 | 92 | */ |
93 | - public function getAvatars(): JsonResponse |
|
94 | - { |
|
95 | - return response()->json(UserFacade::getUser()->getChocolateyId()->relatedAccounts); |
|
96 | - } |
|
93 | + public function getAvatars(): JsonResponse |
|
94 | + { |
|
95 | + return response()->json(UserFacade::getUser()->getChocolateyId()->relatedAccounts); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
98 | + /** |
|
99 | 99 | * Check if an Username is available |
100 | 100 | * for a new Avatar Account. |
101 | 101 | * |
@@ -103,33 +103,33 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return JsonResponse |
105 | 105 | */ |
106 | - public function checkName(Request $request): JsonResponse |
|
107 | - { |
|
108 | - return response()->json(['isAvailable' => (User::where('username', $request->input('name'))->count() == 0 |
|
109 | - && Validation::filterUserName($request->input('name')) && !UserFacade::getUser()->isStaff)]); |
|
110 | - } |
|
106 | + public function checkName(Request $request): JsonResponse |
|
107 | + { |
|
108 | + return response()->json(['isAvailable' => (User::where('username', $request->input('name'))->count() == 0 |
|
109 | + && Validation::filterUserName($request->input('name')) && !UserFacade::getUser()->isStaff)]); |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
112 | + /** |
|
113 | 113 | * Create a New User Avatar. |
114 | 114 | * |
115 | 115 | * @param Request $request |
116 | 116 | * |
117 | 117 | * @return JsonResponse |
118 | 118 | */ |
119 | - public function createAvatar(Request $request): JsonResponse |
|
120 | - { |
|
121 | - if (User::where('username', $request->json()->get('name'))->count() == 0 && Validation::filterUserName($request->json()->get('name'))) { |
|
122 | - $user = $this->createUser($request, ['username' => $request->json()->get('name'), 'email' => UserFacade::getUser()->email]); |
|
119 | + public function createAvatar(Request $request): JsonResponse |
|
120 | + { |
|
121 | + if (User::where('username', $request->json()->get('name'))->count() == 0 && Validation::filterUserName($request->json()->get('name'))) { |
|
122 | + $user = $this->createUser($request, ['username' => $request->json()->get('name'), 'email' => UserFacade::getUser()->email]); |
|
123 | 123 | |
124 | - ChocolateyId::find(UserFacade::getUser()->email)->update(['last_logged_id' => $user->uniqueId]); |
|
124 | + ChocolateyId::find(UserFacade::getUser()->email)->update(['last_logged_id' => $user->uniqueId]); |
|
125 | 125 | |
126 | - return response()->json(''); |
|
127 | - } |
|
126 | + return response()->json(''); |
|
127 | + } |
|
128 | 128 | |
129 | - return response()->json(''); |
|
130 | - } |
|
129 | + return response()->json(''); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
132 | + /** |
|
133 | 133 | * Create a New User. |
134 | 134 | * |
135 | 135 | * @param Request $request |
@@ -138,18 +138,18 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return User |
140 | 140 | */ |
141 | - public function createUser(Request $request, array $userInfo, bool $newUser = false): User |
|
142 | - { |
|
143 | - $userName = $newUser ? $this->uniqueName($userInfo['email']) : $userInfo['username']; |
|
141 | + public function createUser(Request $request, array $userInfo, bool $newUser = false): User |
|
142 | + { |
|
143 | + $userName = $newUser ? $this->uniqueName($userInfo['email']) : $userInfo['username']; |
|
144 | 144 | |
145 | - $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
|
145 | + $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
|
146 | 146 | |
147 | - Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
147 | + Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
148 | 148 | |
149 | - return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
|
150 | - } |
|
149 | + return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
152 | + /** |
|
153 | 153 | * Create Random Unique Username. |
154 | 154 | * |
155 | 155 | * @WARNING: Doesn't create Like Habbo Way |
@@ -158,62 +158,62 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - protected function uniqueName(string $userMail): string |
|
162 | - { |
|
163 | - $partialName = explode(' ', (new Alliteration())->getName()); |
|
161 | + protected function uniqueName(string $userMail): string |
|
162 | + { |
|
163 | + $partialName = explode(' ', (new Alliteration())->getName()); |
|
164 | 164 | |
165 | - return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
166 | - } |
|
165 | + return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
168 | + /** |
|
169 | 169 | * Change Logged In User. |
170 | 170 | * |
171 | 171 | * @param Request $request |
172 | 172 | */ |
173 | - public function selectAvatar(Request $request) |
|
174 | - { |
|
175 | - UserFacade::getUser()->getChocolateyId()->update(['last_logged_id' => $request->json()->get('uniqueId')]); |
|
173 | + public function selectAvatar(Request $request) |
|
174 | + { |
|
175 | + UserFacade::getUser()->getChocolateyId()->update(['last_logged_id' => $request->json()->get('uniqueId')]); |
|
176 | 176 | |
177 | - UserFacade::setSession(User::find($request->json()->get('uniqueId'))); |
|
178 | - } |
|
177 | + UserFacade::setSession(User::find($request->json()->get('uniqueId'))); |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
180 | + /** |
|
181 | 181 | * Send User Forgot E-Mail. |
182 | 182 | * |
183 | 183 | * @param Request $request |
184 | 184 | * |
185 | 185 | * @return JsonResponse |
186 | 186 | */ |
187 | - public function forgotPassword(Request $request): JsonResponse |
|
188 | - { |
|
189 | - if (($user = User::where('mail', $request->json()->get('email'))->first()) == null) { |
|
190 | - return response()->json(['email' => $request->json()->get('email')]); |
|
191 | - } |
|
187 | + public function forgotPassword(Request $request): JsonResponse |
|
188 | + { |
|
189 | + if (($user = User::where('mail', $request->json()->get('email'))->first()) == null) { |
|
190 | + return response()->json(['email' => $request->json()->get('email')]); |
|
191 | + } |
|
192 | 192 | |
193 | - $token = Mail::store($user->email, 'public/forgotPassword'); |
|
193 | + $token = Mail::store($user->email, 'public/forgotPassword'); |
|
194 | 194 | |
195 | - Mail::send(['name' => $user->name, 'email' => $user->email, 'subject' => 'Password reset confirmation', |
|
196 | - 'url' => "/reset-password/{$token}", |
|
197 | - ], 'habbo-web-mail.password-reset'); |
|
195 | + Mail::send(['name' => $user->name, 'email' => $user->email, 'subject' => 'Password reset confirmation', |
|
196 | + 'url' => "/reset-password/{$token}", |
|
197 | + ], 'habbo-web-mail.password-reset'); |
|
198 | 198 | |
199 | - return response()->json(['email' => $user->email]); |
|
200 | - } |
|
199 | + return response()->json(['email' => $user->email]); |
|
200 | + } |
|
201 | 201 | |
202 | - /** |
|
202 | + /** |
|
203 | 203 | * Send an Account Confirmation E-Mail. |
204 | 204 | * |
205 | 205 | * @param Request $request |
206 | 206 | * |
207 | 207 | * @return Response |
208 | 208 | */ |
209 | - public function verifyAccount(Request $request): Response |
|
210 | - { |
|
211 | - $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
|
209 | + public function verifyAccount(Request $request): Response |
|
210 | + { |
|
211 | + $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
|
212 | 212 | |
213 | - Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
|
214 | - 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
215 | - ]); |
|
213 | + Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
|
214 | + 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
215 | + ]); |
|
216 | 216 | |
217 | - return response(null); |
|
218 | - } |
|
217 | + return response(null); |
|
218 | + } |
|
219 | 219 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getIdAttribute(): string |
56 | 56 | { |
57 | - return (string) $this->attributes['id']; |
|
57 | + return (string)$this->attributes['id']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getLikesAttribute(): array |
108 | 108 | { |
109 | - return array_map(function (array $item) { |
|
109 | + return array_map(function(array $item) { |
|
110 | 110 | return $item['username']; |
111 | 111 | }, PhotoLike::query()->select('username')->where('photo_id', $this->attributes['id'])->get(['username'])->toArray()); |
112 | 112 | } |
@@ -1,145 +1,145 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | -use Sofa\Eloquence\Eloquence; |
|
6 | -use Sofa\Eloquence\Mappable; |
|
5 | + use Sofa\Eloquence\Eloquence; |
|
6 | + use Sofa\Eloquence\Mappable; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Class Photo. |
10 | 10 | */ |
11 | -class Photo extends ChocolateyModel |
|
12 | -{ |
|
13 | - use Eloquence, Mappable; |
|
11 | + class Photo extends ChocolateyModel |
|
12 | + { |
|
13 | + use Eloquence, Mappable; |
|
14 | 14 | |
15 | - /** |
|
15 | + /** |
|
16 | 16 | * The table associated with the model. |
17 | 17 | * |
18 | 18 | * @var string |
19 | 19 | */ |
20 | - protected $table = 'camera_web'; |
|
20 | + protected $table = 'camera_web'; |
|
21 | 21 | |
22 | - /** |
|
22 | + /** |
|
23 | 23 | * Primary Key of the Table. |
24 | 24 | * |
25 | 25 | * @var string |
26 | 26 | */ |
27 | - protected $primaryKey = 'id'; |
|
27 | + protected $primaryKey = 'id'; |
|
28 | 28 | |
29 | - /** |
|
29 | + /** |
|
30 | 30 | * The attributes that will be mapped. |
31 | 31 | * |
32 | 32 | * @var array |
33 | 33 | */ |
34 | - protected $maps = ['creator_id' => 'user_id', 'previewUrl' => 'url', 'creator_uniqueId' => 'user_id', 'time' => 'timestamp']; |
|
34 | + protected $maps = ['creator_id' => 'user_id', 'previewUrl' => 'url', 'creator_uniqueId' => 'user_id', 'time' => 'timestamp']; |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * The Appender(s) of the Model. |
38 | 38 | * |
39 | 39 | * @var array |
40 | 40 | */ |
41 | - protected $appends = ['creator_uniqueId', 'version', 'previewUrl', 'creator_id', 'likes', 'tags', 'version', 'type', 'room_id', 'creator_name']; |
|
41 | + protected $appends = ['creator_uniqueId', 'version', 'previewUrl', 'creator_id', 'likes', 'tags', 'version', 'type', 'room_id', 'creator_name']; |
|
42 | 42 | |
43 | - /** |
|
43 | + /** |
|
44 | 44 | * The attributes that should be casted to native types. |
45 | 45 | * |
46 | 46 | * @var array |
47 | 47 | */ |
48 | - protected $casts = ['tags' => 'array', 'creator_uniqueId' => 'string']; |
|
48 | + protected $casts = ['tags' => 'array', 'creator_uniqueId' => 'string']; |
|
49 | 49 | |
50 | - /** |
|
50 | + /** |
|
51 | 51 | * Get the Unique Id of the Photo. |
52 | 52 | * |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - public function getIdAttribute(): string |
|
56 | - { |
|
57 | - return (string) $this->attributes['id']; |
|
58 | - } |
|
55 | + public function getIdAttribute(): string |
|
56 | + { |
|
57 | + return (string) $this->attributes['id']; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
60 | + /** |
|
61 | 61 | * Get the URL of the Photo. |
62 | 62 | * |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - public function getUrlAttribute(): string |
|
66 | - { |
|
67 | - return str_replace('http:', '', str_replace('https:', '', $this->attributes['url'])); |
|
68 | - } |
|
65 | + public function getUrlAttribute(): string |
|
66 | + { |
|
67 | + return str_replace('http:', '', str_replace('https:', '', $this->attributes['url'])); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
70 | + /** |
|
71 | 71 | * Get the Version Attribute. |
72 | 72 | * |
73 | 73 | * @return int |
74 | 74 | */ |
75 | - public function getVersionAttribute(): int |
|
76 | - { |
|
77 | - return 1; |
|
78 | - } |
|
75 | + public function getVersionAttribute(): int |
|
76 | + { |
|
77 | + return 1; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
80 | + /** |
|
81 | 81 | * Get All Tags |
82 | 82 | * Transforming it on an Array. |
83 | 83 | * |
84 | 84 | * @return array(string) |
85 | 85 | */ |
86 | - public function getTagsAttribute(): array |
|
87 | - { |
|
88 | - return []; |
|
89 | - } |
|
86 | + public function getTagsAttribute(): array |
|
87 | + { |
|
88 | + return []; |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
91 | + /** |
|
92 | 92 | * Get Formatted Time |
93 | 93 | * Convert Date to UNIX Timestamp. |
94 | 94 | * |
95 | 95 | * @return int |
96 | 96 | */ |
97 | - public function getTimeAttribute(): int |
|
98 | - { |
|
99 | - return strtotime($this->attributes['timestamp']) * 1000; |
|
100 | - } |
|
97 | + public function getTimeAttribute(): int |
|
98 | + { |
|
99 | + return strtotime($this->attributes['timestamp']) * 1000; |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
102 | + /** |
|
103 | 103 | * Get Photo Likes Directly as Username. |
104 | 104 | * |
105 | 105 | * @return array |
106 | 106 | */ |
107 | - public function getLikesAttribute(): array |
|
108 | - { |
|
109 | - return array_map(function (array $item) { |
|
110 | - return $item['username']; |
|
111 | - }, PhotoLike::query()->select('username')->where('photo_id', $this->attributes['id'])->get(['username'])->toArray()); |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
107 | + public function getLikesAttribute(): array |
|
108 | + { |
|
109 | + return array_map(function (array $item) { |
|
110 | + return $item['username']; |
|
111 | + }, PhotoLike::query()->select('username')->where('photo_id', $this->attributes['id'])->get(['username'])->toArray()); |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | 115 | * Get the Photo Type Attribute. |
116 | 116 | * |
117 | 117 | * @return string |
118 | 118 | */ |
119 | - public function getTypeAttribute(): string |
|
120 | - { |
|
121 | - return 'PHOTO'; |
|
122 | - } |
|
119 | + public function getTypeAttribute(): string |
|
120 | + { |
|
121 | + return 'PHOTO'; |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
124 | + /** |
|
125 | 125 | * Get Room Id. |
126 | 126 | * |
127 | 127 | * @TODO: Add real RoomID |
128 | 128 | * |
129 | 129 | * @return int |
130 | 130 | */ |
131 | - public function getRoomIdAttribute(): int |
|
132 | - { |
|
133 | - return 1; |
|
134 | - } |
|
131 | + public function getRoomIdAttribute(): int |
|
132 | + { |
|
133 | + return 1; |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
136 | + /** |
|
137 | 137 | * Get User Name. |
138 | 138 | * |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function getCreatorNameAttribute(): string |
|
142 | - { |
|
143 | - return User::find($this->attributes['user_id'])->name; |
|
144 | - } |
|
141 | + public function getCreatorNameAttribute(): string |
|
142 | + { |
|
143 | + return User::find($this->attributes['user_id'])->name; |
|
144 | + } |
|
145 | 145 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function checkWords(string $needle): bool |
48 | 48 | { |
49 | - return count(array_filter(Config::get('chocolatey.invalid'), function ($illegal) use ($needle) { |
|
49 | + return count(array_filter(Config::get('chocolatey.invalid'), function($illegal) use ($needle) { |
|
50 | 50 | return stripos($needle, $illegal) !== false; |
51 | 51 | })) == 0; |
52 | 52 | } |
@@ -1,21 +1,21 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Facades; |
|
3 | + namespace App\Facades; |
|
4 | 4 | |
5 | -use Illuminate\Support\Facades\Facade; |
|
5 | + use Illuminate\Support\Facades\Facade; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Class Validation. |
9 | 9 | */ |
10 | -class Validation extends Facade |
|
11 | -{ |
|
12 | - /** |
|
10 | + class Validation extends Facade |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * Get the registered name of the component. |
14 | 14 | * |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - protected static function getFacadeAccessor() |
|
18 | - { |
|
19 | - return 'chocovalidate'; |
|
20 | - } |
|
17 | + protected static function getFacadeAccessor() |
|
18 | + { |
|
19 | + return 'chocovalidate'; |
|
20 | + } |
|
21 | 21 | } |
@@ -1,52 +1,52 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class NuxValidation. |
7 | 7 | */ |
8 | -class NuxValidation |
|
9 | -{ |
|
10 | - /** |
|
8 | + class NuxValidation |
|
9 | + { |
|
10 | + /** |
|
11 | 11 | * Result Code. |
12 | 12 | * |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - public $code; |
|
15 | + public $code; |
|
16 | 16 | |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * Specification of what Happened. |
19 | 19 | * |
20 | 20 | * @var array|null |
21 | 21 | */ |
22 | - public $validationResult = null; |
|
22 | + public $validationResult = null; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Username Suggestions. |
26 | 26 | * |
27 | 27 | * @TODO: Code Suggestions |
28 | 28 | * |
29 | 29 | * @var array|null |
30 | 30 | */ |
31 | - public $suggestions = []; |
|
31 | + public $suggestions = []; |
|
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * Create a NUX Validation. |
35 | 35 | * |
36 | 36 | * @param string $code |
37 | 37 | * @param array $validationResult |
38 | 38 | * @param array $suggestions |
39 | 39 | */ |
40 | - public function __construct(string $code = 'OK', array $validationResult = [], array $suggestions = []) |
|
41 | - { |
|
42 | - $this->code = $code; |
|
40 | + public function __construct(string $code = 'OK', array $validationResult = [], array $suggestions = []) |
|
41 | + { |
|
42 | + $this->code = $code; |
|
43 | 43 | |
44 | - if (!empty($validationResult)) { |
|
45 | - $this->validationResult = $validationResult; |
|
46 | - } |
|
44 | + if (!empty($validationResult)) { |
|
45 | + $this->validationResult = $validationResult; |
|
46 | + } |
|
47 | 47 | |
48 | - if (!empty($suggestions)) { |
|
49 | - $this->suggestions = $suggestions; |
|
50 | - } |
|
51 | - } |
|
48 | + if (!empty($suggestions)) { |
|
49 | + $this->suggestions = $suggestions; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
@@ -1,37 +1,37 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class UserSettings. |
7 | 7 | */ |
8 | -class UserSettings extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class UserSettings extends ChocolateyModel |
|
9 | + { |
|
10 | + /** |
|
11 | 11 | * Disable Timestamps. |
12 | 12 | * |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | - public $timestamps = false; |
|
15 | + public $timestamps = false; |
|
16 | 16 | |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * The table associated with the model. |
19 | 19 | * |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - protected $table = 'users_settings'; |
|
22 | + protected $table = 'users_settings'; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * The attributes that are mass assignable. |
26 | 26 | * |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - protected $fillable = ['user_id', 'block_following', 'block_friendrequests']; |
|
29 | + protected $fillable = ['user_id', 'block_following', 'block_friendrequests']; |
|
30 | 30 | |
31 | - /** |
|
31 | + /** |
|
32 | 32 | * Primary Key of the Table. |
33 | 33 | * |
34 | 34 | * @var string |
35 | 35 | */ |
36 | - protected $primaryKey = 'id'; |
|
36 | + protected $primaryKey = 'id'; |
|
37 | 37 | } |
@@ -1,101 +1,101 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class UserFriend. |
7 | 7 | */ |
8 | -class UserFriend extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class UserFriend extends ChocolateyModel |
|
9 | + { |
|
10 | + /** |
|
11 | 11 | * Disable Timestamps. |
12 | 12 | * |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | - public $timestamps = false; |
|
15 | + public $timestamps = false; |
|
16 | 16 | |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * The table associated with the model. |
19 | 19 | * |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - protected $table = 'messenger_friendships'; |
|
22 | + protected $table = 'messenger_friendships'; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Primary Key of the Table. |
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $primaryKey = 'id'; |
|
29 | + protected $primaryKey = 'id'; |
|
30 | 30 | |
31 | - /** |
|
31 | + /** |
|
32 | 32 | * User Friend Data. |
33 | 33 | * |
34 | 34 | * @var User |
35 | 35 | */ |
36 | - protected $friendData; |
|
36 | + protected $friendData; |
|
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * The attributes excluded from the model's JSON form. |
40 | 40 | * |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $hidden = ['user_one_id', 'user_two_id', 'relation', 'friends_since']; |
|
43 | + protected $hidden = ['user_one_id', 'user_two_id', 'relation', 'friends_since']; |
|
44 | 44 | |
45 | - /** |
|
45 | + /** |
|
46 | 46 | * The Appender(s) of the Model. |
47 | 47 | * |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $appends = ['figureString', 'motto', 'name', 'uniqueId']; |
|
50 | + protected $appends = ['figureString', 'motto', 'name', 'uniqueId']; |
|
51 | 51 | |
52 | - /** |
|
52 | + /** |
|
53 | 53 | * Get User Friend Figure String. |
54 | 54 | * |
55 | 55 | * @return string |
56 | 56 | */ |
57 | - public function getFigureStringAttribute(): string |
|
58 | - { |
|
59 | - return $this->getUserFriendData()->figureString; |
|
60 | - } |
|
57 | + public function getFigureStringAttribute(): string |
|
58 | + { |
|
59 | + return $this->getUserFriendData()->figureString; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
62 | + /** |
|
63 | 63 | * Get User Friend Data. |
64 | 64 | * |
65 | 65 | * @return User |
66 | 66 | */ |
67 | - protected function getUserFriendData(): User |
|
68 | - { |
|
69 | - return User::find($this->attributes['user_two_id']); |
|
70 | - } |
|
67 | + protected function getUserFriendData(): User |
|
68 | + { |
|
69 | + return User::find($this->attributes['user_two_id']); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
72 | + /** |
|
73 | 73 | * Get User Friend Motto. |
74 | 74 | * |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function getMottoAttribute(): string |
|
78 | - { |
|
79 | - return $this->getUserFriendData()->motto; |
|
80 | - } |
|
77 | + public function getMottoAttribute(): string |
|
78 | + { |
|
79 | + return $this->getUserFriendData()->motto; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
82 | + /** |
|
83 | 83 | * Get User Friend Name. |
84 | 84 | * |
85 | 85 | * @return string |
86 | 86 | */ |
87 | - public function getNameAttribute(): string |
|
88 | - { |
|
89 | - return $this->getUserFriendData()->name; |
|
90 | - } |
|
87 | + public function getNameAttribute(): string |
|
88 | + { |
|
89 | + return $this->getUserFriendData()->name; |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
92 | + /** |
|
93 | 93 | * Get User Friend UniqueId. |
94 | 94 | * |
95 | 95 | * @return int |
96 | 96 | */ |
97 | - public function getUniqueIdAttribute(): int |
|
98 | - { |
|
99 | - return $this->getUserFriendData()->uniqueId; |
|
100 | - } |
|
97 | + public function getUniqueIdAttribute(): int |
|
98 | + { |
|
99 | + return $this->getUserFriendData()->uniqueId; |
|
100 | + } |
|
101 | 101 | } |
@@ -1,30 +1,30 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class UserCurrency. |
7 | 7 | */ |
8 | -class UserCurrency extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class UserCurrency extends ChocolateyModel |
|
9 | + { |
|
10 | + /** |
|
11 | 11 | * Disable Timestamps. |
12 | 12 | * |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | - public $timestamps = false; |
|
15 | + public $timestamps = false; |
|
16 | 16 | |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * The table associated with the model. |
19 | 19 | * |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - protected $table = 'users_currency'; |
|
22 | + protected $table = 'users_currency'; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Primary Key of the Table. |
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $primaryKey = 'id'; |
|
29 | + protected $primaryKey = 'id'; |
|
30 | 30 | } |
@@ -1,30 +1,30 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Models; |
|
3 | + namespace App\Models; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class EmulatorSettings. |
7 | 7 | */ |
8 | -class EmulatorSettings extends ChocolateyModel |
|
9 | -{ |
|
10 | - /** |
|
8 | + class EmulatorSettings extends ChocolateyModel |
|
9 | + { |
|
10 | + /** |
|
11 | 11 | * Disable Timestamps. |
12 | 12 | * |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | - public $timestamps = false; |
|
15 | + public $timestamps = false; |
|
16 | 16 | |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * The table associated with the model. |
19 | 19 | * |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - protected $table = 'emulator_settings'; |
|
22 | + protected $table = 'emulator_settings'; |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Primary Key of the Table. |
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $primaryKey = 'id'; |
|
29 | + protected $primaryKey = 'id'; |
|
30 | 30 | } |