From ee0870cb6f41b8f72f97a91b6cb34f74fe30caaa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:02:36 +0000 Subject: [PATCH 1/2] Initial plan From f9a93a0af19d9265da697cde8f21b3902c0ce349 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:07:11 +0000 Subject: [PATCH 2/2] Remove non-backpack-specific commands (model, request, view) Co-authored-by: tabacitu <1032474+tabacitu@users.noreply.github.com> --- README.md | 18 --- src/Console/Commands/ModelBackpackCommand.php | 95 --------------- .../Commands/RequestBackpackCommand.php | 59 ---------- src/Console/Commands/ViewBackpackCommand.php | 109 ------------------ src/Console/stubs/model-softdelete.stub | 90 --------------- src/Console/stubs/model.stub | 86 -------------- src/Console/stubs/request.stub | 54 --------- src/Console/stubs/view-plain.stub | 0 src/Console/stubs/view.stub | 5 - src/GeneratorsServiceProvider.php | 6 - 10 files changed, 522 deletions(-) delete mode 100644 src/Console/Commands/ModelBackpackCommand.php delete mode 100644 src/Console/Commands/RequestBackpackCommand.php delete mode 100644 src/Console/Commands/ViewBackpackCommand.php delete mode 100644 src/Console/stubs/model-softdelete.stub delete mode 100644 src/Console/stubs/model.stub delete mode 100644 src/Console/stubs/request.stub delete mode 100644 src/Console/stubs/view-plain.stub delete mode 100644 src/Console/stubs/view.stub diff --git a/README.md b/README.md index 34d164a..c300be0 100644 --- a/README.md +++ b/README.md @@ -57,24 +57,6 @@ php artisan backpack:crud-model {Entity_name} php artisan backpack:crud-request {Entity_name} ``` -- Generate a model (available options: --softdelete) - -``` bash -php artisan backpack:model {Entity_name} -``` - -- Generate a request - -``` bash -php artisan backpack:request {Entity_name} -``` - -- Generate a view (available options: --plain) - -``` bash -php artisan backpack:view {Entity_name} -``` - - Generate a config file ``` bash diff --git a/src/Console/Commands/ModelBackpackCommand.php b/src/Console/Commands/ModelBackpackCommand.php deleted file mode 100644 index 41ddf7a..0000000 --- a/src/Console/Commands/ModelBackpackCommand.php +++ /dev/null @@ -1,95 +0,0 @@ -option('softdelete')) { - return $this->getStubPath('model-softdelete'); - } - - return $this->getStubPath('model'); - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Models'; - } - - /** - * Replace the table name for the given stub. - * - * @param string $stub - * @param string $name - * @return string - */ - protected function replaceTable(&$stub, $name) - { - $name = ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', str_replace($this->getNamespace($name).'\\', '', $name))), '_'); - - $table = Str::snake(Str::plural($name)); - - $stub = str_replace('DummyTable', $table, $stub); - - return $this; - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - $stub = $this->files->get($this->getStub()); - - return $this->replaceNamespace($stub, $name)->replaceTable($stub, $name)->replaceClass($stub, $name); - } -} diff --git a/src/Console/Commands/RequestBackpackCommand.php b/src/Console/Commands/RequestBackpackCommand.php deleted file mode 100644 index b3a7ac9..0000000 --- a/src/Console/Commands/RequestBackpackCommand.php +++ /dev/null @@ -1,59 +0,0 @@ -getStubPath('request'); - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Http\Requests'; - } -} diff --git a/src/Console/Commands/ViewBackpackCommand.php b/src/Console/Commands/ViewBackpackCommand.php deleted file mode 100644 index 09f6357..0000000 --- a/src/Console/Commands/ViewBackpackCommand.php +++ /dev/null @@ -1,109 +0,0 @@ -option('plain')) { - return $this->getStubPath('view-plain'); - } - - return $this->getStubPath('view'); - } - - /** - * Execute the console command. - * - * @return bool|null - */ - public function handle() - { - $name = $this->getNameInput(); - - $path = $this->getPath($name); - - if ($this->alreadyExists($this->getNameInput())) { - $this->error($this->type.' already existed!'); - - return false; - } - - $this->makeDirectory($path); - - $this->files->put($path, $this->buildClass($name)); - - $this->info($this->type.' created successfully.'); - } - - /** - * Determine if the class already exists. - * - * @param string $name - * @return bool - */ - protected function alreadyExists($name) - { - return $this->files->exists($this->getPath($name)); - } - - /** - * Get the destination class path. - * - * @param string $name - * @return string - */ - protected function getPath($name) - { - return $this->laravel['path'].'/../resources/views/'.str_replace('\\', '/', $name).'.blade.php'; - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - return $this->files->get($this->getStub()); - } -} diff --git a/src/Console/stubs/model-softdelete.stub b/src/Console/stubs/model-softdelete.stub deleted file mode 100644 index 239b442..0000000 --- a/src/Console/stubs/model-softdelete.stub +++ /dev/null @@ -1,90 +0,0 @@ -