false])); } if (!$allowKey->isValidFor("apiKeys.create")) { die(json_encode(["success" => false])); } $newKey = ApiKey::create(); $newLoginApiKey = new ApiKey( null, $call["userId"], $newKey, "login", $call["endDate"], ); $newLoginApiKey->addToDb(); $insertedApiKey = ApiKey::loadFromDb($newKey); if (!$insertedApiKey) { die(json_encode(["success" => false])); } echo json_encode(["success" => true, "apiKey" => $newKey]); }