@@ -27,8 +27,9 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $userData = User::where('username', $request->input('name'))->first(); |
| 29 | 29 | |
| 30 | - if ($userData == null) |
|
| 31 | - return response()->json('', 404); |
|
| 30 | + if ($userData == null) { |
|
| 31 | + return response()->json('', 404); |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | $userPreferences = UserPreferences::find($userData->uniqueId); |
| 34 | 35 | |
@@ -48,13 +49,15 @@ discard block |
||
| 48 | 49 | { |
| 49 | 50 | $userData = User::find($userId); |
| 50 | 51 | |
| 51 | - if ($userData == null) |
|
| 52 | - return response()->json('', 404); |
|
| 52 | + if ($userData == null) { |
|
| 53 | + return response()->json('', 404); |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | $userPreferences = UserPreferences::find($userData->uniqueId); |
| 55 | 57 | |
| 56 | - if ($userPreferences != null && $userPreferences->profileVisible == '0') |
|
| 57 | - return response()->json('', 404); |
|
| 58 | + if ($userPreferences != null && $userPreferences->profileVisible == '0') { |
|
| 59 | + return response()->json('', 404); |
|
| 60 | + } |
|
| 58 | 61 | |
| 59 | 62 | return response()->json(new UserProfile($userData)); |
| 60 | 63 | } |
@@ -90,8 +93,9 @@ discard block |
||
| 90 | 93 | */ |
| 91 | 94 | public function getPhotos(Request $request): JsonResponse |
| 92 | 95 | { |
| 93 | - if (Photo::where('creator_id', $request->user()->uniqueId)->count() == 0) |
|
| 94 | - return response()->json([]); |
|
| 96 | + if (Photo::where('creator_id', $request->user()->uniqueId)->count() == 0) { |
|
| 97 | + return response()->json([]); |
|
| 98 | + } |
|
| 95 | 99 | |
| 96 | 100 | $userPhotos = Photo::where('creator_id', $request->user()->uniqueId)->get(); |
| 97 | 101 | |
@@ -28,8 +28,9 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $leaderRank = 1; |
| 30 | 30 | |
| 31 | - foreach (($leaderBoard = Room::orderBy('score', 'DESC')->limit(50)->get()) as $room) |
|
| 32 | - $room->leaderboardRank = $leaderRank++; |
|
| 31 | + foreach (($leaderBoard = Room::orderBy('score', '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 | } |
@@ -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 | |