@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function register() |
| 20 | 20 | { |
| 21 | - $this->app->bind('azuresession', function () { |
|
| 21 | + $this->app->bind('azuresession', function() { |
|
| 22 | 22 | return Session::getInstance(); |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function boot() |
| 23 | 23 | { |
| 24 | - $this->app['auth']->viaRequest('api', function ($request) { |
|
| 24 | + $this->app['auth']->viaRequest('api', function($request) { |
|
| 25 | 25 | $userData = Session::has('ChocolateyWEB') ? Session::get('ChocolateyWEB') : null; |
| 26 | 26 | |
| 27 | 27 | return $request->path() == 'api/public/authentication/login' |
@@ -50,8 +50,9 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function render($request, Exception $e) |
| 52 | 52 | { |
| 53 | - if ($e instanceof NotFoundHttpException) |
|
| 54 | - return redirect('/'); |
|
| 53 | + if ($e instanceof NotFoundHttpException) { |
|
| 54 | + return redirect('/'); |
|
| 55 | + } |
|
| 55 | 56 | |
| 56 | 57 | return parent::render($request, $e); |
| 57 | 58 | } |
@@ -233,8 +233,9 @@ |
||
| 233 | 233 | */ |
| 234 | 234 | public function getTrustedAttribute(): bool |
| 235 | 235 | { |
| 236 | - if (UserSecurity::find($this->attributes['id']) == null) |
|
| 237 | - return true; |
|
| 236 | + if (UserSecurity::find($this->attributes['id']) == null) { |
|
| 237 | + return true; |
|
| 238 | + } |
|
| 238 | 239 | |
| 239 | 240 | return in_array($this->trusted, UserSecurity::find($this->attributes['id'])->trustedDevices); |
| 240 | 241 | } |
@@ -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 | } |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | * |
| 89 | 89 | * @return User |
| 90 | 90 | */ |
| 91 | - protected function getUserFriendData(): ?User |
|
| 91 | + protected function getUserFriendData(): ? User |
|
| 92 | 92 | { |
| 93 | 93 | return User::find($this->attributes['user_two_id']); |
| 94 | 94 | } |
@@ -182,7 +182,7 @@ |
||
| 182 | 182 | * @param bool $newUser If is a New User |
| 183 | 183 | * @return User |
| 184 | 184 | */ |
| 185 | - public function createUser(Request $request, array $userInfo, bool $newUser = false): ?User |
|
| 185 | + public function createUser(Request $request, array $userInfo, bool $newUser = false): ? User |
|
| 186 | 186 | { |
| 187 | 187 | $userName = $newUser ? uniqid(strstr($userInfo['email'], '@', true)) : $userInfo['name']; |
| 188 | 188 | |
@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function checkName(Request $request): JsonResponse |
| 27 | 27 | { |
| 28 | - if (User::where('username', $request->json()->get('name'))->count() > 0) |
|
| 29 | - return response()->json(['code' => 'NAME_IN_USE', 'validationResult' => null, 'suggestions' => []]); |
|
| 28 | + if (User::where('username', $request->json()->get('name'))->count() > 0) { |
|
| 29 | + return response()->json(['code' => 'NAME_IN_USE', 'validationResult' => null, 'suggestions' => []]); |
|
| 30 | + } |
|
| 30 | 31 | |
| 31 | 32 | return response()->json(['code' => 'OK', 'validationResult' => null, 'suggestions' => []]); |
| 32 | 33 | } |
@@ -74,8 +75,9 @@ discard block |
||
| 74 | 75 | */ |
| 75 | 76 | public function selectRoom(Request $request): JsonResponse |
| 76 | 77 | { |
| 77 | - if (!in_array($request->json()->get('roomIndex'), [1, 2, 3])) |
|
| 78 | - return response('', 400); |
|
| 78 | + if (!in_array($request->json()->get('roomIndex'), [1, 2, 3])) { |
|
| 79 | + return response('', 400); |
|
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | return response()->json(); |
| 81 | 83 | } |
@@ -103,8 +105,9 @@ discard block |
||
| 103 | 105 | { |
| 104 | 106 | $userPreferences = UserPreferences::find($request->user()->uniqueId); |
| 105 | 107 | |
| 106 | - foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) |
|
| 107 | - $userPreferences->{$attributeName} = $attributeValue == 1; |
|
| 108 | + foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
| 109 | + $userPreferences->{$attributeName} = $attributeValue == 1; |
|
| 110 | + } |
|
| 108 | 111 | |
| 109 | 112 | return response()->json($userPreferences); |
| 110 | 113 | } |
@@ -150,8 +153,9 @@ discard block |
||
| 150 | 153 | */ |
| 151 | 154 | public function checkNewName(Request $request): JsonResponse |
| 152 | 155 | { |
| 153 | - if (User::where('username', $request->input('name'))->count() > 0) |
|
| 154 | - return response()->json(['isAvailable' => false]); |
|
| 156 | + if (User::where('username', $request->input('name'))->count() > 0) { |
|
| 157 | + return response()->json(['isAvailable' => false]); |
|
| 158 | + } |
|
| 155 | 159 | |
| 156 | 160 | return response()->json(['isAvailable' => true]); |
| 157 | 161 | } |
@@ -164,8 +168,9 @@ discard block |
||
| 164 | 168 | */ |
| 165 | 169 | public function createAvatar(Request $request): JsonResponse |
| 166 | 170 | { |
| 167 | - if (User::where('username', $request->json()->get('name'))->count() > 0) |
|
| 168 | - return response()->json(['isAvailable' => false]); |
|
| 171 | + if (User::where('username', $request->json()->get('name'))->count() > 0) { |
|
| 172 | + return response()->json(['isAvailable' => false]); |
|
| 173 | + } |
|
| 169 | 174 | |
| 170 | 175 | $request->user()->name = $request->json()->get('name'); |
| 171 | 176 | |
@@ -52,11 +52,13 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | public function register(Request $request): JsonResponse |
| 54 | 54 | { |
| 55 | - if (strpos($request->json()->get('email'), '@') == false) |
|
| 56 | - return response()->json(['error' => 'registration_email'], 409); |
|
| 55 | + if (strpos($request->json()->get('email'), '@') == false) { |
|
| 56 | + return response()->json(['error' => 'registration_email'], 409); |
|
| 57 | + } |
|
| 57 | 58 | |
| 58 | - if (ChocolateyId::query()->where('mail', $request->json()->get('email'))->count() > 0) |
|
| 59 | - return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 59 | + if (ChocolateyId::query()->where('mail', $request->json()->get('email'))->count() > 0) { |
|
| 60 | + return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 61 | + } |
|
| 60 | 62 | |
| 61 | 63 | $userData = (new AccountController) |
| 62 | 64 | ->createUser($request, $request->json()->all(), true); |
@@ -74,8 +74,9 @@ |
||
| 74 | 74 | { |
| 75 | 75 | $articleContent = Article::find(substr($articleName, 0, strpos($articleName, '_'))); |
| 76 | 76 | |
| 77 | - if ($articleContent == null) |
|
| 78 | - return response()->json('', 404); |
|
| 77 | + if ($articleContent == null) { |
|
| 78 | + return response()->json('', 404); |
|
| 79 | + } |
|
| 79 | 80 | |
| 80 | 81 | return response(view('habbo-web-news.articles-view', [ |
| 81 | 82 | 'article' => $articleContent, |