public function setReorder(Request $request, $databox_id)
    {
        try {
            foreach ($request->request->get('order', []) as $data) {
                $collection = \collection::getByBaseId($this->app, $data['id']);
                $collection->set_ord($data['offset']);
            }
            $success = true;
        } catch (\Exception $e) {
            $success = false;
        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
                'sbas_id' => $databox_id,
            ]);
        }

        return $this->app->redirectPath('admin_database_display_collections_order', [
            'databox_id' => $databox_id,
            'success'    => (int) $success,
        ]);
    }
public function setReorder(Request $request, $databox_id)
    {
        try {
            foreach ($request->request->get('order', []) as $data) {
                $collection = \collection::getByBaseId($this->app, $data['id']);
                $collection->set_ord($data['offset']);
            }
            $success = true;
        } catch (\Exception $e) {
            $success = false;
        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
                'sbas_id' => $databox_id,
            ]);
        }

        return $this->app->redirectPath('admin_database_display_collections_order', [
            'databox_id' => $databox_id,
            'success'    => (int) $success,
        ]);
    }
public function setReorder ( Request $ request , $ databox_id ) { try { foreach ( $ request -> request -> get ( 'order' , [ ] ) as $ data ) { $ collection = \ collection :: getByBaseId ( $ this -> app , $ data [ 'id' ] ) ; $ collection -> set_ord ( $ data [ 'offset' ] ) ; } $ success = true ; } catch ( \ Exception $ e ) { $ success = false ; } if ( 'json' === $ request -> getRequestFormat ( ) ) { return $ this -> app -> json ( [ 'success' => $ success , 'msg' => $ success ? $ this -> app -> trans ( 'Successful update' ) : $ this -> app -> trans ( 'An error occured' ) , 'sbas_id' => $ databox_id , ] ) ; } return $ this -> app -> redirectPath ( 'admin_database_display_collections_order' , [ 'databox_id' => $ databox_id , 'success' => ( int ) $ success , ] ) ; }
Apply collection reorder changes

@param  Request $request    The current HTTP request
@param  integer $databox_id The requested databox
@return JsonResponse|RedirectResponse
Apply collection reorder changes