Files
cachet-docker/app/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php
2015-08-31 20:16:38 +01:00

39 lines
976 B
PHP

<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Handlers\Commands\ComponentGroup;
use CachetHQ\Cachet\Commands\ComponentGroup\AddComponentGroupCommand;
use CachetHQ\Cachet\Events\ComponentGroup\ComponentGroupWasAddedEvent;
use CachetHQ\Cachet\Models\ComponentGroup;
class AddComponentGroupCommandHandler
{
/**
* Handle the add component group command.
*
* @param \CachetHQ\Cachet\Commands\ComponentGroup\AddComponentGroupCommand $command
*
* @return void
*/
public function handle(AddComponentGroupCommand $command)
{
$group = ComponentGroup::create([
'name' => $command->name,
'order' => $command->order,
]);
event(new ComponentGroupWasAddedEvent($group));
return $group;
}
}