Added ticket deletion; fixed some small issues with the ticket list on the home page
This commit is contained in:
@ -11,7 +11,7 @@ use BitGoblin\Goliath\Models\Ticket;
|
||||
class TicketController extends Controller {
|
||||
|
||||
public function getView(Request $request, Response $response, array $args): Response {
|
||||
$ticket = Ticket::where('id', $args['ticket_id'])->get()[0];
|
||||
$ticket = Ticket::where('id', $args['ticket_id'])->first();
|
||||
|
||||
$view = Twig::fromRequest($request);
|
||||
return $view->render($response, 'ticket/view.twig', [
|
||||
@ -69,4 +69,14 @@ class TicketController extends Controller {
|
||||
->withStatus(302);
|
||||
}
|
||||
|
||||
public function getDelete(Request $request, Response $response, array $args): Response {
|
||||
$ticket = Ticket::where('id', $args['ticket_id'])->first();
|
||||
|
||||
$ticket->delete();
|
||||
|
||||
return $response
|
||||
->withHeader('Location', '/')
|
||||
->withStatus(302);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user