From dc73f628037f56c37cda6d7aa7b519aa92cd4563 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 28 Jul 2016 10:47:59 -0400 Subject: [PATCH] Fixes issues with updating using dashboard api. Closes #2014 --- .../Controllers/Dashboard/ApiController.php | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/Dashboard/ApiController.php b/app/Http/Controllers/Dashboard/ApiController.php index 207a3875..42a437fe 100644 --- a/app/Http/Controllers/Dashboard/ApiController.php +++ b/app/Http/Controllers/Dashboard/ApiController.php @@ -38,13 +38,13 @@ class ApiController extends AbstractApiController try { dispatch(new UpdateComponentCommand( $component, - null, - null, + $component->name, + $component->description, Binput::get('status'), - null, - null, - null, - null + $component->link, + $component->order, + $component->group_id, + $component->enabled )); } catch (QueryException $e) { throw new BadRequestHttpException(); @@ -64,15 +64,17 @@ class ApiController extends AbstractApiController foreach ($componentData as $order => $componentId) { try { + $component = Component::find($componentId); + dispatch(new UpdateComponentCommand( - Component::find($componentId), - null, - null, - null, - null, + $component, + $component->name, + $component->description, + $component->status, + $component->link, $order + 1, - null, - null + $component->group_id, + $component->enabled )); } catch (QueryException $e) { throw new BadRequestHttpException(); @@ -92,11 +94,13 @@ class ApiController extends AbstractApiController $groupData = Binput::get('ids'); foreach ($groupData as $order => $groupId) { + $group = ComponentGroup::find($groupId); + dispatch(new UpdateComponentGroupCommand( - ComponentGroup::find($groupId), - null, + $group, + $group->name, $order + 1, - null + $group->collapsed )); }