Added ability to change the ticket status

This commit is contained in:
2022-12-04 15:00:26 -05:00
parent f3ac8a6965
commit 5d5265ef38
5 changed files with 55 additions and 5 deletions

View File

@ -69,6 +69,23 @@ class TicketController extends Controller {
->withStatus(302);
}
public function postEditAttr(Request $request, Response $response, array $args): Response {
// grab ticket from database
$ticket = Ticket::where('id', $args['ticket_id'])->first();
// edit the specified attribute
$params = (array)$request->getParsedBody();
$attr = $args['attr'];
$ticket->$attr = $params[$attr];
// save updated ticket
$ticket->save();
// return a response
$response->getBody()->write(json_encode(['status' => 'success']));
return $response;
}
public function getDelete(Request $request, Response $response, array $args): Response {
$ticket = Ticket::where('id', $args['ticket_id'])->first();