From 733232e8c9cccc0facfb25519be93f7c43569438 Mon Sep 17 00:00:00 2001 From: "Nicholas K. Dionysopoulos" Date: Wed, 18 Oct 2023 13:55:36 +0300 Subject: [PATCH] CLI commands to manage sites Implement `sites:enable` and `sites:disable` Reference: gh-47 --- src/CliCommand/SitesDisable.php | 50 +++++++++++++++++++++++++++++++++ src/CliCommand/SitesEnable.php | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/CliCommand/SitesDisable.php create mode 100644 src/CliCommand/SitesEnable.php diff --git a/src/CliCommand/SitesDisable.php b/src/CliCommand/SitesDisable.php new file mode 100644 index 00000000..3dfb9a84 --- /dev/null +++ b/src/CliCommand/SitesDisable.php @@ -0,0 +1,50 @@ +mvcFactory->makeTempModel('Sites'); + + $id = intval($input->getArgument('id')); + + $model + ->findOrFail($id) + ->unpublish(); + + return Command::SUCCESS; + } + + protected function configure(): void + { + $this + ->addArgument('id', InputArgument::REQUIRED, 'The numeric site ID to disable'); + } + +} \ No newline at end of file diff --git a/src/CliCommand/SitesEnable.php b/src/CliCommand/SitesEnable.php new file mode 100644 index 00000000..9bd048e0 --- /dev/null +++ b/src/CliCommand/SitesEnable.php @@ -0,0 +1,50 @@ +mvcFactory->makeTempModel('Sites'); + + $id = intval($input->getArgument('id')); + + $model + ->findOrFail($id) + ->publish(); + + return Command::SUCCESS; + } + + protected function configure(): void + { + $this + ->addArgument('id', InputArgument::REQUIRED, 'The numeric site ID to enable'); + } + +} \ No newline at end of file