auth = $auth; } /** * Handle the remove component group command. * * @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand $command * * @return void */ public function handle(RemoveComponentGroupCommand $command) { $group = $command->group; event(new ComponentGroupWasRemovedEvent($this->auth->user(), $group)); // Remove the group id from all component. $group->components->map(function ($component) { $component->update(['group_id' => 0]); }); $group->delete(); } }