postType = $postType; } /** * @return void * @throws \Exception */ public function execute(): void { $customPostTypeModel = CustomPostTypeRepository::get([ 'postType' => $this->postType, ]); if (empty($customPostTypeModel)) { throw new \Exception("Post type not found"); } $customPostTypeModel = $customPostTypeModel[0]; $labels = $customPostTypeModel->defaultLabels(); $customPostTypeModel->setLabels($labels); CustomPostTypeRepository::save($customPostTypeModel); } }