This commit is contained in:
James Brooks
2015-05-26 19:13:46 +01:00
parent e6f6946497
commit 502ae9d2a0
4 changed files with 27 additions and 23 deletions

View File

@@ -46,8 +46,9 @@ class ApiController extends AbstractController
*/
public function postUpdateComponentOrder()
{
$componentData = Binput::all();
foreach ($componentData['ids'] as $order => $componentId) {
$componentData = Binput::get('ids');
return $componentData;
foreach ($componentData as $order => $componentId) {
// Ordering should be 1-based, data comes in 0-based
Component::find($componentId)->update(['order' => $order + 1]);
}
@@ -62,8 +63,8 @@ class ApiController extends AbstractController
*/
public function postUpdateComponentGroupOrder()
{
$groupData = Binput::all();
foreach ($groupData['ids'] as $order => $groupId) {
$groupData = Binput::get('ids');
foreach ($groupData as $order => $groupId) {
ComponentGroup::find($groupId)->update([
'order' => $order + 1,
]);