-
Notifications
You must be signed in to change notification settings - Fork 0
/
TicketAdminController.php
41 lines (33 loc) · 1.03 KB
/
TicketAdminController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace App\Controller;
use Cake\Core\Configure;
use Cake\ORM\TableRegistry;
class TicketAdminController extends AdminController {
public function index() {
$tickets = TableRegistry::get('Tickets');
$pass = [];
$query = null;
if ($this->adminTheater == 0) {
$query = $tickets->find()
->contain(['Seats', 'Rows', 'Sections', 'Performances', 'Performances.Plays']);
} else {
$query = $tickets->find()
->where(["theater_id" => $this->adminTheater])
->contain(['Seats', 'Rows', 'Sections', 'Performances', 'Performances.Plays']);
}
foreach ($query as $row) {
$pass[] = [
"id" => $row->id,
"seat" => $row->getSeatName(),
"number" => "123456-F12",
"performance_name" => $row->performance->play->name,
"performance_time" => $row->ticketTime(),
"person_name" => $row->customer_name,
"payment_status" => $row->ticketStatusName(),
"payment_status_value" => $row->status,
"payment_state" => $row->ticketStatusColor()
];
}
$this->set("tickets", $pass);
}
}