@@ -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 | } |
@@ -54,8 +54,9 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function likePhoto(Request $request, $photoId): JsonResponse |
| 56 | 56 | { |
| 57 | - if (PhotoLike::where('username', $request->user()->name)->where('photo_id', $photoId)->count() > 0) |
|
| 58 | - return response()->json(''); |
|
| 57 | + if (PhotoLike::where('username', $request->user()->name)->where('photo_id', $photoId)->count() > 0) { |
|
| 58 | + return response()->json(''); |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | (new PhotoLike)->store($photoId, $request->user()->name)->save(); |
| 61 | 62 | |
@@ -71,8 +72,9 @@ discard block |
||
| 71 | 72 | */ |
| 72 | 73 | public function unlikePhoto(Request $request, $photoId): JsonResponse |
| 73 | 74 | { |
| 74 | - if (PhotoLike::where('username', $request->user()->name)->where('photo_id', $photoId)->count() == 0) |
|
| 75 | - return response()->json(''); |
|
| 75 | + if (PhotoLike::where('username', $request->user()->name)->where('photo_id', $photoId)->count() == 0) { |
|
| 76 | + return response()->json(''); |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | PhotoLike::where('username', $request->user()->name)->where('photo_id', $photoId)->delete(); |
| 78 | 80 | |
@@ -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 | { |
@@ -29,8 +29,9 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function featureStatus(Request $request): Response |
| 31 | 31 | { |
| 32 | - if ($request->user()->emailVerified == false) |
|
| 33 | - return response('identity_verification_required', 200); |
|
| 32 | + if ($request->user()->emailVerified == false) { |
|
| 33 | + return response('identity_verification_required', 200); |
|
| 34 | + } |
|
| 34 | 35 | |
| 35 | 36 | $featureEnabled = UserSecurity::find($request->user()->uniqueId); |
| 36 | 37 | |
@@ -45,8 +46,9 @@ discard block |
||
| 45 | 46 | */ |
| 46 | 47 | public function saveQuestions(Request $request): JsonResponse |
| 47 | 48 | { |
| 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); |
|
| 49 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() == 0) { |
|
| 50 | + return response()->json(['error' => 'invalid_password'], 400); |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | UserSecurity::updateOrCreate([ |
| 52 | 54 | 'user_id' => $request->user()->uniqueId, |
@@ -94,12 +96,14 @@ discard block |
||
| 94 | 96 | */ |
| 95 | 97 | public function changePassword(Request $request): JsonResponse |
| 96 | 98 | { |
| 97 | - if (strlen($request->json()->get('password')) < 6) |
|
| 98 | - return response()->json(['error' => 'password.current_password.invalid'], 409); |
|
| 99 | + if (strlen($request->json()->get('password')) < 6) { |
|
| 100 | + return response()->json(['error' => 'password.current_password.invalid'], 409); |
|
| 101 | + } |
|
| 99 | 102 | |
| 100 | 103 | //@TODO: This search the whole base. If anyone has the same password.. This will give error. Is this good? |
| 101 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() >= 1) |
|
| 102 | - return response()->json(['error' => 'password.used_earlier'], 409); |
|
| 104 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() >= 1) { |
|
| 105 | + return response()->json(['error' => 'password.used_earlier'], 409); |
|
| 106 | + } |
|
| 103 | 107 | |
| 104 | 108 | User::find($request->user()->uniqueId)->update(['password' => |
| 105 | 109 | hash(Config::get('chocolatey.security.hash'), $request->json()->get('password'))]); |
@@ -115,11 +119,13 @@ discard block |
||
| 115 | 119 | */ |
| 116 | 120 | public function changeMail(Request $request): JsonResponse |
| 117 | 121 | { |
| 118 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() == 0) |
|
| 119 | - return response()->json(['error' => 'changeEmail.invalid_password'], 400); |
|
| 122 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() == 0) { |
|
| 123 | + return response()->json(['error' => 'changeEmail.invalid_password'], 400); |
|
| 124 | + } |
|
| 120 | 125 | |
| 121 | - if (ChocolateyId::where('mail', $request->json()->get('newEmail'))->count() > 0) |
|
| 122 | - return response()->json(['error' => 'changeEmail.email_already_in_use'], 400); |
|
| 126 | + if (ChocolateyId::where('mail', $request->json()->get('newEmail'))->count() > 0) { |
|
| 127 | + return response()->json(['error' => 'changeEmail.email_already_in_use'], 400); |
|
| 128 | + } |
|
| 123 | 129 | |
| 124 | 130 | $this->sendChangeMailConfirmation($request); |
| 125 | 131 | |
@@ -160,8 +166,9 @@ discard block |
||
| 160 | 166 | */ |
| 161 | 167 | public function getQuestions(Request $request): JsonResponse |
| 162 | 168 | { |
| 163 | - if (UserSecurity::find($request->user()->uniqueId) == null) |
|
| 164 | - return response()->json(''); |
|
| 169 | + if (UserSecurity::find($request->user()->uniqueId) == null) { |
|
| 170 | + return response()->json(''); |
|
| 171 | + } |
|
| 165 | 172 | |
| 166 | 173 | $userSecurity = UserSecurity::find($request->user()->uniqueId); |
| 167 | 174 | |
@@ -185,8 +192,9 @@ discard block |
||
| 185 | 192 | ->where('firstAnswer', $request->json()->get('answer1')) |
| 186 | 193 | ->where('secondAnswer', $request->json()->get('answer2'))->count() > 0 |
| 187 | 194 | ): |
| 188 | - if ($request->json()->get('trust') == true) |
|
| 189 | - (new TrustedDevice)->store($request->user()->uniqueId, $request->ip())->save(); |
|
| 195 | + if ($request->json()->get('trust') == true) { |
|
| 196 | + (new TrustedDevice)->store($request->user()->uniqueId, $request->ip())->save(); |
|
| 197 | + } |
|
| 190 | 198 | |
| 191 | 199 | return response()->json(null, 204); |
| 192 | 200 | endif; |
@@ -204,11 +212,13 @@ discard block |
||
| 204 | 212 | { |
| 205 | 213 | $mailRequest = Mail::where('token', $request->json()->get('token'))->where('used', '0')->first(); |
| 206 | 214 | |
| 207 | - if ($mailRequest == null) |
|
| 208 | - return response()->json(null, 404); |
|
| 215 | + if ($mailRequest == null) { |
|
| 216 | + return response()->json(null, 404); |
|
| 217 | + } |
|
| 209 | 218 | |
| 210 | - if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() >= 1) |
|
| 211 | - return response()->json(['error' => 'password.used_earlier'], 400); |
|
| 219 | + if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('password')))->count() >= 1) { |
|
| 220 | + return response()->json(['error' => 'password.used_earlier'], 400); |
|
| 221 | + } |
|
| 212 | 222 | |
| 213 | 223 | $mailRequest->update(['used' => '1']); |
| 214 | 224 | |
@@ -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 | { |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
| 45 | 45 | { |
| 46 | 46 | try { |
| 47 | - Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
| 47 | + Mail::send($view, $configuration, function($message) use ($configuration) { |
|
| 48 | 48 | $message->from(Config::get('chocolatey.contact'), Config::get('chocolatey.name')); |
| 49 | 49 | $message->to($configuration['mail']); |
| 50 | 50 | }); |
@@ -76,8 +76,9 @@ |
||
| 76 | 76 | { |
| 77 | 77 | $mailRequest = MailModel::where('token', $token)->where('used', '0')->first(); |
| 78 | 78 | |
| 79 | - if ($mailRequest !== null) |
|
| 80 | - $mailRequest->update(['used' => '1']); |
|
| 79 | + if ($mailRequest !== null) { |
|
| 80 | + $mailRequest->update(['used' => '1']); |
|
| 81 | + } |
|
| 81 | 82 | |
| 82 | 83 | return $mailRequest; |
| 83 | 84 | } |