repository = $repository; } // Obtener todos los registros public function index() { return $this->repository->getAll(); } // Crear un nuevo registro public function create(array $data) { return $this->repository->insert($data); } // Actualizar un registro public function update($id, array $data) { return $this->repository->update($id, $data); } // Eliminar un registro public function delete($id) { return $this->repository->delete($id); } // Eliminar un registro activo public function deleteActive($id) { return $this->repository->deleteActive($id); } // Renderizar una vista protected function render($view, $data = []) { extract($data); $viewPath = realpath(__DIR__ . "/../Views/{$view}.php"); if (file_exists($viewPath)) { include $viewPath; } else { echo "Error: La vista '{$view}' no se encontrĂ³ en {$viewPath}."; } } }