Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/Group/DeleteCommand.php
Show All 22 Lines | class DeleteCommand extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$input = $this->argument('group'); | $input = $this->argument('group'); | ||||
$group = $this->getObject(\App\Group::class, $input, 'email'); | $group = $this->getGroup($input); | ||||
if (empty($group)) { | if (empty($group)) { | ||||
$this->error("Group {$input} does not exist."); | $this->error("Group {$input} does not exist."); | ||||
return 1; | return 1; | ||||
} | } | ||||
$group->delete(); | $group->delete(); | ||||
} | } | ||||
} | } |