Skip to content

Commit 4c48896

Browse files
alexp8Sneer-ra2
andauthored
Develop (#383)
* Duplicate handling. * Added page of list with active duplicates. * Full IP-check for confirmed duplicates. * Simplification. * Removed comment. * Small update. * Added database migration. * Added unit test. * track observers * move comment * update image.php * fix null pointer (#379) * Develop (#380) (#381) * Duplicate handling. * Added page of list with active duplicates. * Full IP-check for confirmed duplicates. * Simplification. * Removed comment. * Small update. * Added database migration. * Added unit test. * track observers * move comment * update image.php * fix null pointer (#379) --------- Co-authored-by: Sneer <[email protected]> Co-authored-by: Sneer-ra2 <[email protected]> * add more logs (#382) * add more logs * update log * Fix for createPlayer. --------- Co-authored-by: Sneer <[email protected]> Co-authored-by: Sneer-ra2 <[email protected]>
1 parent f83ea64 commit 4c48896

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cncnet-api/app/Http/Controllers/ApiPlayerController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Http\JsonResponse;
1111
use Illuminate\Http\Request;
1212
use Illuminate\Validation\ValidationException;
13+
use Illuminate\Support\Facades\Log;
1314

1415
class ApiPlayerController extends Controller
1516
{
@@ -73,6 +74,7 @@ public function getUsernames(Request $request)
7374
}
7475
catch (Exception $ex)
7576
{
77+
Log::error("Exception in ApiPlayerController@getUsernames", ['exception' => $ex]);
7678
return response()->json(["message" => "Something went wrong"], 500);
7779
}
7880
}
@@ -100,7 +102,7 @@ public function createPlayer(Request $request)
100102

101103
# Check ladder exists
102104
$ladder = \App\Models\Ladder::where("abbreviation", '=', $request->ladderAbbrev)->first();
103-
$ladderHistory = $ladder->currentHistory;
105+
$ladderHistory = $ladder->currentHistory();
104106
if ($ladder === null || $ladderHistory === null)
105107
{
106108
return response()->json(["message" => "Ladder does not exist"], 400);
@@ -126,10 +128,12 @@ public function createPlayer(Request $request)
126128
}
127129
catch (ValidationException $ex)
128130
{
131+
Log::warning("ValidationException in ApiPlayerController@createPlayer", ['errors' => $ex->errors()]);
129132
return response()->json(["message" => $ex->getMessage()], 400);
130133
}
131134
catch (Exception $ex)
132135
{
136+
Log::error("Exception in ApiPlayerController@createPlayer", ['exception' => $ex]);
133137
return response()->json(["message" => "Something went wrong"], 500);
134138
}
135139
}
@@ -221,10 +225,12 @@ public function togglePlayerStatus(Request $request)
221225
}
222226
catch (ValidationException $ex)
223227
{
228+
Log::warning("ValidationException in ApiPlayerController@togglePlayerStatus", ['errors' => $ex->errors()]);
224229
return response()->json(["message" => $ex->getMessage()], 400);
225230
}
226231
catch (Exception $ex)
227232
{
233+
Log::error("Exception in ApiPlayerController@togglePlayerStatus", ['exception' => $ex]);
228234
return response()->json(["message" => "Something went wrong"], 500);
229235
}
230236
}

0 commit comments

Comments
 (0)