Added AddComponentGroupCommand

This commit is contained in:
James Brooks
2015-08-30 21:37:29 +01:00
parent 698b05980d
commit 6ee697cf7f
6 changed files with 103 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Commands\Component\AddComponentCommand;
use CachetHQ\Cachet\Commands\Component\RemoveComponentCommand;
use CachetHQ\Cachet\Commands\ComponentGroup\AddComponentGroupCommand;
use CachetHQ\Cachet\Commands\ComponentGroup\RemoveComponentGroupCommand;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\ComponentGroup;
@@ -246,7 +247,10 @@ class ComponentController extends Controller
public function postAddComponentGroup()
{
try {
$group = ComponentGroup::create(Binput::get('group'));
$group = $this->dispatch(new AddComponentGroupCommand(
Binput::get('name'),
Binput::get('order', 0)
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.components.groups.add')
->withInput(Binput::all())