Added ability to change the ticket status
This commit is contained in:
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user