@@ -28,8 +28,9 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $leaderRank = 1; |
| 30 | 30 | |
| 31 | - foreach (($leaderBoard = Room::orderBy('score', 'DESC')->orderBy('users', 'DESC')->limit(50)->get()) as $room) |
|
| 32 | - $room->leaderboardRank = $leaderRank++; |
|
| 31 | + foreach (($leaderBoard = Room::orderBy('score', 'DESC')->orderBy('users', 'DESC')->limit(50)->get()) as $room) { |
|
| 32 | + $room->leaderboardRank = $leaderRank++; |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | return response()->json($leaderBoard, 200, array(), JSON_UNESCAPED_SLASHES); |
| 35 | 36 | } |
@@ -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 | |
@@ -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 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function register() |
| 20 | 20 | { |
| 21 | - $this->app->bind('chocosession', function () { |
|
| 21 | + $this->app->bind('chocosession', function() { |
|
| 22 | 22 | return Session::getInstance(); |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function boot() |
| 25 | 25 | { |
| 26 | - $this->app['auth']->viaRequest('api', function ($request) { |
|
| 26 | + $this->app['auth']->viaRequest('api', function($request) { |
|
| 27 | 27 | return $request->path() == 'api/public/authentication/login' |
| 28 | 28 | ? $this->auth($request) : $this->recover($request); |
| 29 | 29 | }); |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | public function getUserHead(Request $request) |
| 25 | 25 | { |
| 26 | 26 | return redirect(Config::get('chocolatey.imaging') . 'avatarimage?figure=' |
| 27 | - . ($request->has('figure') ? $request->input('figure') : |
|
| 28 | - User::where('username', $request->input('user'))->first()->figureString) |
|
| 27 | + . ($request->has('figure') ? $request->input('figure') : User::where('username', $request->input('user'))->first()->figureString) |
|
| 29 | 28 | . '&size=l&headonly=1'); |
| 30 | 29 | } |
| 31 | 30 | |
@@ -235,7 +235,7 @@ |
||
| 235 | 235 | */ |
| 236 | 236 | public function getTraitsAttribute(): array |
| 237 | 237 | { |
| 238 | - if(array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= 6) |
|
| 238 | + if (array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= 6) |
|
| 239 | 239 | return ["STAFF"]; |
| 240 | 240 | |
| 241 | 241 | return $this->traits; |
@@ -235,8 +235,9 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function getTraitsAttribute(): array |
| 237 | 237 | { |
| 238 | - if(array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= 6) |
|
| 239 | - return ["STAFF"]; |
|
| 238 | + if(array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= 6) { |
|
| 239 | + return ["STAFF"]; |
|
| 240 | + } |
|
| 240 | 241 | |
| 241 | 242 | return $this->traits; |
| 242 | 243 | } |
@@ -248,8 +249,9 @@ discard block |
||
| 248 | 249 | */ |
| 249 | 250 | public function getTrustedAttribute(): bool |
| 250 | 251 | { |
| 251 | - if (UserSecurity::find($this->attributes['id']) == null) |
|
| 252 | - return true; |
|
| 252 | + if (UserSecurity::find($this->attributes['id']) == null) { |
|
| 253 | + return true; |
|
| 254 | + } |
|
| 253 | 255 | |
| 254 | 256 | return in_array($this->attributes['ip_current'], |
| 255 | 257 | UserSecurity::find($this->attributes['id'])->trustedDevices); |
@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | public function login(Request $request): JsonResponse |
| 25 | 25 | { |
| 26 | 26 | if ($request->user()): |
| 27 | - if ($request->user()->isBanned) |
|
| 28 | - $this->sendBanMessage($request); |
|
| 27 | + if ($request->user()->isBanned) { |
|
| 28 | + $this->sendBanMessage($request); |
|
| 29 | + } |
|
| 29 | 30 | |
| 30 | 31 | $request->user()->update(['last_login' => time(), 'ip_current' => $request->ip()]); |
| 31 | 32 | |
@@ -69,18 +70,21 @@ discard block |
||
| 69 | 70 | */ |
| 70 | 71 | public function register(Request $request): JsonResponse |
| 71 | 72 | { |
| 72 | - if (strpos($request->json()->get('email'), '@') == false) |
|
| 73 | - return response()->json(['error' => 'registration_email'], 409); |
|
| 73 | + if (strpos($request->json()->get('email'), '@') == false) { |
|
| 74 | + return response()->json(['error' => 'registration_email'], 409); |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | - if (ChocolateyId::query()->where('mail', $request->json()->get('email'))->count() > 0) |
|
| 76 | - return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 77 | + if (ChocolateyId::query()->where('mail', $request->json()->get('email'))->count() > 0) { |
|
| 78 | + return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 79 | + } |
|
| 77 | 80 | |
| 78 | 81 | $userData = (new AccountController)->createUser($request, $request->json()->all(), true); |
| 79 | 82 | |
| 80 | 83 | $userData->update(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip()]); |
| 81 | 84 | |
| 82 | - if (Config::get('chocolatey.vote.enabled')) |
|
| 83 | - Session::set('VotePolicy', true); |
|
| 85 | + if (Config::get('chocolatey.vote.enabled')) { |
|
| 86 | + Session::set('VotePolicy', true); |
|
| 87 | + } |
|
| 84 | 88 | |
| 85 | 89 | return response()->json($userData); |
| 86 | 90 | } |