diff --git a/src/app/Console/ObjectDeleteCommand.php b/src/app/Console/ObjectDeleteCommand.php index 7a7e9026..3e228480 100644 --- a/src/app/Console/ObjectDeleteCommand.php +++ b/src/app/Console/ObjectDeleteCommand.php @@ -1,95 +1,95 @@ description = "Delete a {$this->objectName}"; $this->signature = sprintf( "%s%s:delete {%s}", $this->commandPrefix ? $this->commandPrefix . ":" : "", $this->objectName, $this->objectName ); $class = new $this->objectClass(); try { foreach (Schema::getColumnListing($class->getTable()) as $column) { if ($column == "id") { continue; } $this->signature .= " {--{$column}=}"; } } catch (\Exception $e) { \Log::error("Could not extract options: {$e->getMessage()}"); } $classes = class_uses_recursive($this->objectClass); parent::__construct(); } public function getProperties() { if (!empty($this->properties)) { return $this->properties; } $class = new $this->objectClass(); $this->properties = []; foreach (Schema::getColumnListing($class->getTable()) as $column) { if ($column == "id") { continue; } if (($value = $this->option($column)) !== null) { $this->properties[$column] = $value; } } return $this->properties; } /** * Execute the console command. * * @return mixed */ public function handle() { $result = parent::handle(); if (!$result) { return 1; } $argument = $this->argument($this->objectName); $object = $this->getObject($this->objectClass, $argument, $this->objectTitle); if (!$object) { $this->error("No such {$this->objectName} {$argument}"); return 1; } if ($this->commandPrefix == 'scalpel') { $this->objectClass::withoutEvents( function () use ($object) { $object->delete(); } ); } } } diff --git a/src/app/Console/ScalpelCommand.php b/src/app/Console/ScalpelCommand.php deleted file mode 100644 index 96cdfce3..00000000 --- a/src/app/Console/ScalpelCommand.php +++ /dev/null @@ -1,26 +0,0 @@ -dangerous) { - $this->warn( - "This command is a dangerous scalpel command with potentially significant unintended consequences" - ); - - $confirmation = $this->confirm("Are you sure you understand what's about to happen?"); - - if (!$confirmation) { - $this->info("Better safe than sorry."); - return false; - } - - $this->info("VĂ¡monos!"); - } - - return true; - } -}