model = new CategoryModel(); } public function __invoke(ServerRequestInterface $request) { $body = json_decode((string)$request->getBody(), true) ?? []; $companyId = $body['company_id'] ?? null; $created = $this->model->createCategory( $body['category_name'], $companyId, $body['category_is_kitchen'] ?? false ); return $created ? ResponseLib::sendOk(['created' => true]) : ResponseLib::sendFail("Failed to Create Category", [], "E_VALIDATE")->withStatus(402); } }