'staff_1', 'requestData' => [ 'page' => [ 'validation' => DataValidator::numeric(), 'error' => ERRORS::INVALID_PAGE ] ] ]; } public function handler() { $user = Controller::getLoggedUser(); $closed = Controller::request('closed'); $page = Controller::request('page'); $departmentId = Controller::request('departmentId'); $offset = ($page-1)*10; $condition = 'TRUE'; $bindings = []; if($departmentId) { $condition .= ' AND department_id = ?'; $bindings[] = $departmentId; } if(!$closed) { $condition .= ' AND closed = ?'; $bindings[] = '0'; } $countTotal = $user->withCondition($condition, $bindings)->countShared('ticket'); $condition .= ' LIMIT 10 OFFSET ?'; $bindings[] = $offset; $tickets = $user->withCondition($condition, $bindings)->sharedTicketList->toArray(true); Response::respondSuccess([ 'tickets' => $tickets, 'page' => $page, 'pages' => ceil($countTotal / 10) ]); } }