src/Api/Controller/CdnObject.php
public function getTrash()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:cdn:manager:object:browse')) {
            throw new ApiException(
                'You do not have permission to access this resource',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput   = Factory::service('Input');
        $oModel   = Factory::model('ObjectTrash', 'nails/module-cdn');
        $iPage    = (int) $oInput->get('page') ?: 1;
        $aResults = $oModel->getAll(
            $iPage,
            static::MAX_OBJECTS_PER_REQUEST,
            ['sort' => [['trashed', 'desc']]]
        );

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData(array_map(
            function ($oObj) {
                $oObj->is_img = isset($oObj->img);
                $oObj->url    = (object) [
                    'src'     => cdnServe($oObj->id),
                    'preview' => isset($oObj->img) ? cdnCrop($oObj->id, 400, 400) : null,
                ];
                return $oObj;
            },
            $aResults
        ));
        return $oResponse;
    }
public function getTrash()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:cdn:manager:object:browse')) {
            throw new ApiException(
                'You do not have permission to access this resource',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput   = Factory::service('Input');
        $oModel   = Factory::model('ObjectTrash', 'nails/module-cdn');
        $iPage    = (int) $oInput->get('page') ?: 1;
        $aResults = $oModel->getAll(
            $iPage,
            static::MAX_OBJECTS_PER_REQUEST,
            ['sort' => [['trashed', 'desc']]]
        );

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData(array_map(
            function ($oObj) {
                $oObj->is_img = isset($oObj->img);
                $oObj->url    = (object) [
                    'src'     => cdnServe($oObj->id),
                    'preview' => isset($oObj->img) ? cdnCrop($oObj->id, 400, 400) : null,
                ];
                return $oObj;
            },
            $aResults
        ));
        return $oResponse;
    }
public function getTrash ( ) { $ oHttpCodes = Factory :: service ( 'HttpCodes' ) ; if ( ! userHasPermission ( 'admin:cdn:manager:object:browse' ) ) { throw new ApiException ( 'You do not have permission to access this resource' , $ oHttpCodes :: STATUS_UNAUTHORIZED ) ; } $ oInput = Factory :: service ( 'Input' ) ; $ oModel = Factory :: model ( 'ObjectTrash' , 'nails/module-cdn' ) ; $ iPage = ( int ) $ oInput -> get ( 'page' ) ? : 1 ; $ aResults = $ oModel -> getAll ( $ iPage , static :: MAX_OBJECTS_PER_REQUEST , [ 'sort' => [ [ 'trashed' , 'desc' ] ] ] ) ; $ oResponse = Factory :: factory ( 'ApiResponse' , 'nails/module-api' ) ; $ oResponse -> setData ( array_map ( function ( $ oObj ) { $ oObj -> is_img = isset ( $ oObj -> img ) ; $ oObj -> url = ( object ) [ 'src' => cdnServe ( $ oObj -> id ) , 'preview' => isset ( $ oObj -> img ) ? cdnCrop ( $ oObj -> id , 400 , 400 ) : null , ] ; return $ oObj ; } , $ aResults ) ) ; return $ oResponse ; }
List items in the trash

@return array
List items in the trash