@@ -98,8 +98,9 @@ |
||
| 98 | 98 | { |
| 99 | 99 | $categories = []; |
| 100 | 100 | |
| 101 | - foreach (explode(',', $this->attributes['categories']) as $articleCategory) |
|
| 102 | - $categories[] = ArticleCategory::query()->where('link', $articleCategory)->first(); |
|
| 101 | + foreach (explode(',', $this->attributes['categories']) as $articleCategory) { |
|
| 102 | + $categories[] = ArticleCategory::query()->where('link', $articleCategory)->first(); |
|
| 103 | + } |
|
| 103 | 104 | |
| 104 | 105 | return $categories; |
| 105 | 106 | } |
@@ -67,8 +67,9 @@ |
||
| 67 | 67 | { |
| 68 | 68 | $paymentMethods = []; |
| 69 | 69 | |
| 70 | - foreach (PaymentCategory::where('country_code', $countryCode)->get(['payment_type']) as $paymentMethod) |
|
| 71 | - $paymentMethods[] = $paymentMethod->payment_type; |
|
| 70 | + foreach (PaymentCategory::where('country_code', $countryCode)->get(['payment_type']) as $paymentMethod) { |
|
| 71 | + $paymentMethods[] = $paymentMethod->payment_type; |
|
| 72 | + } |
|
| 72 | 73 | |
| 73 | 74 | $this->paymentCategories = $paymentMethods; |
| 74 | 75 | } |
@@ -50,8 +50,9 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function render($request, Exception $e) |
| 52 | 52 | { |
| 53 | - if ($e instanceof NotFoundHttpException) |
|
| 54 | - return response(view('habbo-web')); |
|
| 53 | + if ($e instanceof NotFoundHttpException) { |
|
| 54 | + return response(view('habbo-web')); |
|
| 55 | + } |
|
| 55 | 56 | |
| 56 | 57 | return parent::render($request, $e); |
| 57 | 58 | } |
@@ -94,8 +94,9 @@ |
||
| 94 | 94 | { |
| 95 | 95 | $groups = GroupMember::where('user_id', $this->user->uniqueId)->get() ?? []; |
| 96 | 96 | |
| 97 | - foreach ($groups as $group) |
|
| 98 | - $this->groups[] = $group->guild; |
|
| 97 | + foreach ($groups as $group) { |
|
| 98 | + $this->groups[] = $group->guild; |
|
| 99 | + } |
|
| 99 | 100 | } |
| 100 | 101 | |
| 101 | 102 | /** |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | * Confirm User Change Password |
| 184 | 184 | * |
| 185 | 185 | * @param Request $request |
| 186 | - * @return mixed |
|
| 186 | + * @return JsonResponse |
|
| 187 | 187 | */ |
| 188 | 188 | public function confirmChangePassword(Request $request): JsonResponse |
| 189 | 189 | { |
@@ -28,8 +28,9 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function featureStatus(Request $request): Response |
| 30 | 30 | { |
| 31 | - if ($request->user()->emailVerified == false) |
|
| 32 | - return response('identity_verification_required', 200); |
|
| 31 | + if ($request->user()->emailVerified == false) { |
|
| 32 | + return response('identity_verification_required', 200); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | $featureEnabled = UserSecurity::find($request->user()->uniqueId); |
| 35 | 36 | |
@@ -44,8 +45,9 @@ discard block |
||
| 44 | 45 | */ |
| 45 | 46 | public function saveQuestions(Request $request): JsonResponse |
| 46 | 47 | { |
| 47 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() == 0) |
|
| 48 | - return response()->json(['error' => 'invalid_password'], 400); |
|
| 48 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() == 0) { |
|
| 49 | + return response()->json(['error' => 'invalid_password'], 400); |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | UserSecurity::updateOrCreate([ |
| 51 | 53 | 'user_id' => $request->user()->uniqueId, |
@@ -93,12 +95,14 @@ discard block |
||
| 93 | 95 | */ |
| 94 | 96 | public function changePassword(Request $request): JsonResponse |
| 95 | 97 | { |
| 96 | - if (strlen($request->json()->get('password')) < 6) |
|
| 97 | - return response()->json(['error' => 'password.current_password.invalid'], 409); |
|
| 98 | + if (strlen($request->json()->get('password')) < 6) { |
|
| 99 | + return response()->json(['error' => 'password.current_password.invalid'], 409); |
|
| 100 | + } |
|
| 98 | 101 | |
| 99 | 102 | //@TODO: This search the whole base. If anyone has the same password.. This will give error. Is this good? |
| 100 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() >= 1) |
|
| 101 | - return response()->json(['error' => 'password.used_earlier'], 409); |
|
| 103 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() >= 1) { |
|
| 104 | + return response()->json(['error' => 'password.used_earlier'], 409); |
|
| 105 | + } |
|
| 102 | 106 | |
| 103 | 107 | User::find($request->user()->uniqueId)->update(['password' => |
| 104 | 108 | hash(Config::get('chocolatey.security.hash'), $request->json()->get('password'))]); |
@@ -114,11 +118,13 @@ discard block |
||
| 114 | 118 | */ |
| 115 | 119 | public function changeMail(Request $request): JsonResponse |
| 116 | 120 | { |
| 117 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() == 0) |
|
| 118 | - return response()->json(['error' => 'changeEmail.invalid_password'], 400); |
|
| 121 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() == 0) { |
|
| 122 | + return response()->json(['error' => 'changeEmail.invalid_password'], 400); |
|
| 123 | + } |
|
| 119 | 124 | |
| 120 | - if (ChocolateyId::where('mail', $request->json()->get('newEmail'))->count() > 0) |
|
| 121 | - return response()->json(['error' => 'changeEmail.email_already_in_use'], 400); |
|
| 125 | + if (ChocolateyId::where('mail', $request->json()->get('newEmail'))->count() > 0) { |
|
| 126 | + return response()->json(['error' => 'changeEmail.email_already_in_use'], 400); |
|
| 127 | + } |
|
| 122 | 128 | |
| 123 | 129 | $this->sendChangeMailConfirmation($request); |
| 124 | 130 | |
@@ -159,8 +165,9 @@ discard block |
||
| 159 | 165 | */ |
| 160 | 166 | public function getQuestions(Request $request): JsonResponse |
| 161 | 167 | { |
| 162 | - if (UserSecurity::find($request->user()->uniqueId) == null) |
|
| 163 | - return response()->json(''); |
|
| 168 | + if (UserSecurity::find($request->user()->uniqueId) == null) { |
|
| 169 | + return response()->json(''); |
|
| 170 | + } |
|
| 164 | 171 | |
| 165 | 172 | $userSecurity = UserSecurity::find($request->user()->uniqueId); |
| 166 | 173 | |
@@ -184,8 +191,9 @@ discard block |
||
| 184 | 191 | ->where('firstAnswer', $request->json()->get('answer1')) |
| 185 | 192 | ->where('secondAnswer', $request->json()->get('answer2'))->count() > 0 |
| 186 | 193 | ): |
| 187 | - if ($request->json()->get('trust') == true) |
|
| 188 | - (new TrustedDevice)->store($request->user()->uniqueId, $request->ip())->save(); |
|
| 194 | + if ($request->json()->get('trust') == true) { |
|
| 195 | + (new TrustedDevice)->store($request->user()->uniqueId, $request->ip())->save(); |
|
| 196 | + } |
|
| 189 | 197 | |
| 190 | 198 | return response()->json(null, 204); |
| 191 | 199 | endif; |
@@ -201,11 +209,13 @@ discard block |
||
| 201 | 209 | */ |
| 202 | 210 | public function confirmChangePassword(Request $request): JsonResponse |
| 203 | 211 | { |
| 204 | - if (($mail = (new MailController)->getMail($request->json()->get('token'))) == null) |
|
| 205 | - return response()->json(null, 404); |
|
| 212 | + if (($mail = (new MailController)->getMail($request->json()->get('token'))) == null) { |
|
| 213 | + return response()->json(null, 404); |
|
| 214 | + } |
|
| 206 | 215 | |
| 207 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() >= 1) |
|
| 208 | - return response()->json(['error' => 'password.used_earlier'], 400); |
|
| 216 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() >= 1) { |
|
| 217 | + return response()->json(['error' => 'password.used_earlier'], 400); |
|
| 218 | + } |
|
| 209 | 219 | |
| 210 | 220 | $mail->update(['used' => '1']); |
| 211 | 221 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function register() |
| 15 | 15 | { |
| 16 | 16 | // Register Mailing Services |
| 17 | - $this->app->singleton('mailer', function ($app) { |
|
| 17 | + $this->app->singleton('mailer', function($app) { |
|
| 18 | 18 | return $app->loadComponent('mail', 'Illuminate\Mail\MailServiceProvider', 'mailer'); |
| 19 | 19 | }); |
| 20 | 20 | } |
@@ -99,8 +99,9 @@ |
||
| 99 | 99 | { |
| 100 | 100 | $voucher = DB::table('vouchers')->where('code', $request->json()->get('voucherCode'))->first(); |
| 101 | 101 | |
| 102 | - if ($voucher == null) |
|
| 103 | - return response()->json(null, 404); |
|
| 102 | + if ($voucher == null) { |
|
| 103 | + return response()->json(null, 404); |
|
| 104 | + } |
|
| 104 | 105 | |
| 105 | 106 | DB::table('users')->where('id', $request->user()->uniqueId)->increment('credits', $voucher->credits); |
| 106 | 107 | DB::table('users')->where('id', $request->user()->uniqueId)->increment('pixels', $voucher->points); |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | * @TODO: Ability of custom this shit |
| 149 | 149 | * |
| 150 | 150 | * @param Request $request |
| 151 | - * @return mixed |
|
| 151 | + * @return JsonResponse |
|
| 152 | 152 | */ |
| 153 | 153 | public function getWall(Request $request): JsonResponse |
| 154 | 154 | { |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | public function getTrustedDevicesAttribute(): array |
| 69 | 69 | { |
| 70 | 70 | return TrustedDevice::where('user_id', $this->attributes['user_id'])->get(['ip_address']) |
| 71 | - ->map(function ($item) { |
|
| 71 | + ->map(function($item) { |
|
| 72 | 72 | return $item->ip_address; |
| 73 | 73 | })->toArray(); |
| 74 | 74 | } |
@@ -61,8 +61,9 @@ discard block |
||
| 61 | 61 | return $category->name == 'all' || in_array($category, $item->categories); |
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | - if ($articles->count() == 0) |
|
| 65 | - return response()->json(null, 404); |
|
| 64 | + if ($articles->count() == 0) { |
|
| 65 | + return response()->json(null, 404); |
|
| 66 | + } |
|
| 66 | 67 | |
| 67 | 68 | return response(view('habbo-web-news.articles-category', [ |
| 68 | 69 | 'category' => $category, |
@@ -83,8 +84,9 @@ discard block |
||
| 83 | 84 | */ |
| 84 | 85 | public function one(string $countryId, string $articleName): Response |
| 85 | 86 | { |
| 86 | - if (($article = Article::find(strstr($articleName, '_', true))) == null) |
|
| 87 | - return response()->json(null, 404); |
|
| 87 | + if (($article = Article::find(strstr($articleName, '_', true))) == null) { |
|
| 88 | + return response()->json(null, 404); |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
| 90 | 92 | return in_array($article->categories[0], $item->categories); |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $categoryPage = strstr(strrev($articleCategory), '_', true); |
| 30 | 30 | |
| 31 | - return $articleCategory == 'front' ? $this->front() : |
|
| 32 | - $this->category($countryId, $category, $categoryPage, |
|
| 31 | + return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage, |
|
| 33 | 32 | $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1))); |
| 34 | 33 | } |
| 35 | 34 | |
@@ -58,7 +57,7 @@ discard block |
||
| 58 | 57 | protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response |
| 59 | 58 | { |
| 60 | 59 | $articles = Article::where('id', '>=', $start) |
| 61 | - ->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) { |
|
| 60 | + ->limit(10)->orderBy('id', 'DESC')->get()->filter(function($item) use ($category) { |
|
| 62 | 61 | return $category->name == 'all' || in_array($category, $item->categories); |
| 63 | 62 | }); |
| 64 | 63 | |
@@ -87,7 +86,7 @@ discard block |
||
| 87 | 86 | if (($article = Article::find(strstr($articleName, '_', true))) == null) |
| 88 | 87 | return response()->json(null, 404); |
| 89 | 88 | |
| 90 | - $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
|
| 89 | + $related = ($latest = Article::all())->filter(function($item) use ($article) { |
|
| 91 | 90 | return in_array($article->categories[0], $item->categories); |
| 92 | 91 | }); |
| 93 | 92 | |