public function position(OrderUpdateRequest $request, $id)
    {
        $record  = $this->modelRepository->findOrFail($id);
        $success = false;
        $result  = null;

        if ($this->getModelInformation()->list->orderable) {
            $success = true;
            $result  = $this->changeModelOrderablePosition($record, $request->get('position'));
        }

        if ($success && config('cms-models.notifications.flash.position')) {
            cms_flash(
                cms_trans(
                    'models.store.success-message-position',
                    [ 'record' => $this->getSimpleRecordReference($id, $record) ]
                ),
                FlashLevel::SUCCESS
            );
        }

        event( new Events\ModelPositionUpdatedInCms($record) );

        if (request()->ajax()) {
            return response()->json([ 'success' => $success, 'position' => $result ]);
        }

        return redirect()->back();
    }
public function position(OrderUpdateRequest $request, $id)
    {
        $record  = $this->modelRepository->findOrFail($id);
        $success = false;
        $result  = null;

        if ($this->getModelInformation()->list->orderable) {
            $success = true;
            $result  = $this->changeModelOrderablePosition($record, $request->get('position'));
        }

        if ($success && config('cms-models.notifications.flash.position')) {
            cms_flash(
                cms_trans(
                    'models.store.success-message-position',
                    [ 'record' => $this->getSimpleRecordReference($id, $record) ]
                ),
                FlashLevel::SUCCESS
            );
        }

        event( new Events\ModelPositionUpdatedInCms($record) );

        if (request()->ajax()) {
            return response()->json([ 'success' => $success, 'position' => $result ]);
        }

        return redirect()->back();
    }
public function position ( OrderUpdateRequest $ request , $ id ) { $ record = $ this -> modelRepository -> findOrFail ( $ id ) ; $ success = false ; $ result = null ; if ( $ this -> getModelInformation ( ) -> list -> orderable ) { $ success = true ; $ result = $ this -> changeModelOrderablePosition ( $ record , $ request -> get ( 'position' ) ) ; } if ( $ success && config ( 'cms-models.notifications.flash.position' ) ) { cms_flash ( cms_trans ( 'models.store.success-message-position' , [ 'record' => $ this -> getSimpleRecordReference ( $ id , $ record ) ] ) , FlashLevel :: SUCCESS ) ; } event ( new Events \ ModelPositionUpdatedInCms ( $ record ) ) ; if ( request ( ) -> ajax ( ) ) { return response ( ) -> json ( [ 'success' => $ success , 'position' => $ result ] ) ; } return redirect ( ) -> back ( ) ; }
Changes orderable position for a record.

@param OrderUpdateRequest $request
@param int                $id
@return mixed
@event ModelPositionUpdatedInCms
Changes orderable position for a record .