Added a details page for test results; added an API route for removing test results
This commit is contained in:
@@ -66,6 +66,23 @@ class ApiController extends Controller {
|
||||
->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
public function getResultDelete(Request $request, Response $response, array $args): Response {
|
||||
$result = Result::where('id', $args['result_id'])->delete();
|
||||
|
||||
$payload = json_encode($result);
|
||||
|
||||
$referrer = $request->getHeaderLine('Referer');
|
||||
if ($referrer) {
|
||||
return $response
|
||||
->withHeader('Location', $referrer)
|
||||
->withStatus(302);
|
||||
}
|
||||
|
||||
$response->getBody()->write($payload);
|
||||
return $response
|
||||
->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
public function getTestDetails(Request $request, Response $response, array $args): Response {
|
||||
$urlParams = $request->getQueryParams();
|
||||
$test = Test::where('id', $urlParams['test_id'])->first();
|
||||
|
||||
Reference in New Issue
Block a user