src/Gzero/Api/Transformer/FileTransformer.php
public function transform($file)
    {
        $thumb = null;

        if ($file->type === 'image') {
            $width  = config('gzero.image.thumb.width');
            $height = config('gzero.image.thumb.height');
            $thumb  = croppaUrl($file->getFullPath(), $width, $height);
        }

        $file = $this->entityToArray(File::class, $file);
        return [
            'id'        => (int) $file['id'],
            'type'      => $file['type'],
            'name'      => $file['name'],
            'extension' => $file['extension'],
            'size'      => (int) $file['size'],
            'mimeType'  => $file['mime_type'],
            'info'      => $file['info'],
            'thumb'     => $thumb,
            'weight'    => $this->setPivotNullableValue($file, 'weight'),
            'isActive'  => (bool) $file['is_active'],
            'createdBy' => (int) $file['created_by'],
            'createdAt' => $file['created_at'],
            'updatedAt' => $file['updated_at']
        ];
    }
public function transform($file)
    {
        $thumb = null;

        if ($file->type === 'image') {
            $width  = config('gzero.image.thumb.width');
            $height = config('gzero.image.thumb.height');
            $thumb  = croppaUrl($file->getFullPath(), $width, $height);
        }

        $file = $this->entityToArray(File::class, $file);
        return [
            'id'        => (int) $file['id'],
            'type'      => $file['type'],
            'name'      => $file['name'],
            'extension' => $file['extension'],
            'size'      => (int) $file['size'],
            'mimeType'  => $file['mime_type'],
            'info'      => $file['info'],
            'thumb'     => $thumb,
            'weight'    => $this->setPivotNullableValue($file, 'weight'),
            'isActive'  => (bool) $file['is_active'],
            'createdBy' => (int) $file['created_by'],
            'createdAt' => $file['created_at'],
            'updatedAt' => $file['updated_at']
        ];
    }
public function transform ( $ file ) { $ thumb = null ; if ( $ file -> type === 'image' ) { $ width = config ( 'gzero.image.thumb.width' ) ; $ height = config ( 'gzero.image.thumb.height' ) ; $ thumb = croppaUrl ( $ file -> getFullPath ( ) , $ width , $ height ) ; } $ file = $ this -> entityToArray ( File :: class , $ file ) ; return [ 'id' => ( int ) $ file [ 'id' ] , 'type' => $ file [ 'type' ] , 'name' => $ file [ 'name' ] , 'extension' => $ file [ 'extension' ] , 'size' => ( int ) $ file [ 'size' ] , 'mimeType' => $ file [ 'mime_type' ] , 'info' => $ file [ 'info' ] , 'thumb' => $ thumb , 'weight' => $ this -> setPivotNullableValue ( $ file , 'weight' ) , 'isActive' => ( bool ) $ file [ 'is_active' ] , 'createdBy' => ( int ) $ file [ 'created_by' ] , 'createdAt' => $ file [ 'created_at' ] , 'updatedAt' => $ file [ 'updated_at' ] ] ; }
Transforms file entity

@param File|array $file file entity

@return array
Transforms file entity