Added http response code
This commit is contained in:
@@ -14,11 +14,19 @@ if (!isAdmin()){
|
||||
$all_group_in_game_jam_id = Group::where("game_jam_id", $game_jam->id)->pluck("id")->toArray();
|
||||
$find_all_keywords = KeyWord::whereIn("group_id", $all_group_in_game_jam_id)->inRandomOrder()->get();
|
||||
$game_jam->key_word = $find_all_keywords->first()->key_word;
|
||||
$game_jam->save();
|
||||
if(!$game_jam->save()){
|
||||
http_response_code(500);
|
||||
}else{
|
||||
http_response_code(201);
|
||||
}
|
||||
|
||||
header("Access-Control-Allow-Methods: GET");
|
||||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||
header('Content-Type: application/json;charset=UTF-8');
|
||||
echo $find_all_keywords->pluck("key_word")->toJson(JSON_PRETTY_PRINT);
|
||||
}else{
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
http_response_code(401);
|
||||
}
|
||||
@@ -25,23 +25,19 @@ if (isLogin()) {
|
||||
|
||||
//Try to save it
|
||||
if(!$keyword->save()){
|
||||
header("location: ../../../Frontend/index.html?error=FailedToSave");
|
||||
exit();
|
||||
http_response_code(500);
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?success=KeyWordSaved");
|
||||
exit();
|
||||
http_response_code(201);
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=YouCantSubmitAnyMoreKeyWords");
|
||||
exit();
|
||||
echo "limited upload reached";
|
||||
http_response_code(400);
|
||||
}
|
||||
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=CouldNotSubmitKeyWord");
|
||||
exit();
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=NotLogin");
|
||||
exit();
|
||||
http_response_code(401);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user