@@ -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 | } |
@@ -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 | } |
@@ -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 | { |
@@ -70,8 +70,9 @@ discard block |
||
| 70 | 70 | ->where('category', $paymentCategory)->where('country', $countryCode) |
| 71 | 71 | ->where('item', $shopItem)->where('method', $paymentMethod)->first(); |
| 72 | 72 | |
| 73 | - if ((strtotime($paymentCheckout->generated_at) + 172800) < time()) |
|
| 74 | - return response(view('habbo-web-payments.canceled-payment'), 400); |
|
| 73 | + if ((strtotime($paymentCheckout->generated_at) + 172800) < time()) { |
|
| 74 | + return response(view('habbo-web-payments.canceled-payment'), 400); |
|
| 75 | + } |
|
| 75 | 76 | |
| 76 | 77 | return $paymentCheckout != null ? response(view('habbo-web-payments.proceed', ['payment' => $paymentCheckout])) |
| 77 | 78 | : response(view('habbo-web-payments.failed-payment'), 400); |
@@ -95,8 +96,9 @@ discard block |
||
| 95 | 96 | ->where('category', $paymentCategory)->where('country', $countryCode) |
| 96 | 97 | ->where('item', $shopItem)->where('method', $paymentMethod)->first(); |
| 97 | 98 | |
| 98 | - if ($paymentCheckout == null) |
|
| 99 | - return response(view('habbo-web-payments.canceled-payment'), 500); |
|
| 99 | + if ($paymentCheckout == null) { |
|
| 100 | + return response(view('habbo-web-payments.canceled-payment'), 500); |
|
| 101 | + } |
|
| 100 | 102 | |
| 101 | 103 | $purchaseItem = (new ShopHistory)->store($paymentMethod, $request->user()->uniqueId, $shopItem); |
| 102 | 104 | $purchaseItem->save(); |
@@ -138,8 +140,9 @@ discard block |
||
| 138 | 140 | { |
| 139 | 141 | $voucher = DB::table('vouchers')->where('code', $request->json()->get('voucherCode'))->first(); |
| 140 | 142 | |
| 141 | - if ($voucher == null) |
|
| 142 | - return response()->json(null, 404); |
|
| 143 | + if ($voucher == null) { |
|
| 144 | + return response()->json(null, 404); |
|
| 145 | + } |
|
| 143 | 146 | |
| 144 | 147 | DB::table('users')->where('id', $request->user()->uniqueId)->increment('credits', $voucher->credits); |
| 145 | 148 | DB::table('users')->where('id', $request->user()->uniqueId)->increment('pixels', $voucher->points); |
@@ -93,8 +93,9 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $paymentMethods = []; |
| 95 | 95 | |
| 96 | - if (!array_key_exists('payment_methods', $this->attributes)) |
|
| 97 | - return $paymentMethods; |
|
| 96 | + if (!array_key_exists('payment_methods', $this->attributes)) { |
|
| 97 | + return $paymentMethods; |
|
| 98 | + } |
|
| 98 | 99 | |
| 99 | 100 | foreach (explode(',', $this->attributes['payment_methods']) as $shopCategory): |
| 100 | 101 | $paymentMethod = PaymentMethod::where('localizationKey', $shopCategory)->first(); |
@@ -115,8 +116,9 @@ discard block |
||
| 115 | 116 | { |
| 116 | 117 | $shopCategories = []; |
| 117 | 118 | |
| 118 | - foreach (explode(',', $this->attributes['categories']) as $shopCategory) |
|
| 119 | - $shopCategories[] = ShopCategory::find($shopCategory)->category; |
|
| 119 | + foreach (explode(',', $this->attributes['categories']) as $shopCategory) { |
|
| 120 | + $shopCategories[] = ShopCategory::find($shopCategory)->category; |
|
| 121 | + } |
|
| 120 | 122 | |
| 121 | 123 | return $shopCategories; |
| 122 | 124 | } |