requireAuth(); if ($auth instanceof ResponseInterface) { return $auth; } $params = $this->getPaginationParams(); $builder = $this->getDB()->table('brochure_requests'); // Search by applicant name $name = $this->request->getGet('name'); if ($name) { $builder->like('applicant_name', $name); } $builder->orderBy('id', 'DESC'); $result = $this->paginatedResponse($builder, $params); return $this->respondSuccess($result); } /** * Update brochure request status */ public function updateStatus($id) { $auth = $this->requireAuth(); if ($auth instanceof ResponseInterface) { return $auth; } $json = $this->request->getJSON(); $data = [ 'status' => $json->status ?? '접수', 'updated_at' => date('Y-m-d H:i:s') ]; $builder = $this->getDB()->table('brochure_requests'); $builder->where('id', $id)->update($data); return $this->respondSuccess(null, '상태가 변경되었습니다.'); } /** * Delete brochure request */ public function delete($id = null) { $auth = $this->requireAuth(); if ($auth instanceof ResponseInterface) { return $auth; } $builder = $this->getDB()->table('brochure_requests'); $builder->where('id', $id)->delete(); return $this->respondSuccess(null, '브로셔 요청이 삭제되었습니다.'); } /** * Export to Excel */ public function exportExcel() { $auth = $this->requireAuth(); if ($auth instanceof ResponseInterface) { return $auth; } // TODO: Implement Excel export logic return $this->respondSuccess(null, 'Excel export endpoint'); } }