ticketModel = new TicketModel(); $this->view = $view; } public function showTickets() { $tickets = $this->ticketModel->getTickets(); $this->view->setVars(['tickets' => $tickets]); } public function buyTicket() { $data = [ 'user_id' => $_POST['user_id'] ?? null, 'event_id' => $_POST['event_id'] ?? null, 'price' => $_POST['price'] ?? null ]; $result = $this->ticketModel->createTicket($data); $this->view->setVars(['ticket' => $result]); } public function deleteTicket() { $ticketid = $_GET['ticketid'] ?? null; if ($ticketid) { $this->ticketModel->deleteTicket($ticketid); } } }