PHP code example of jedrzej / pimpable

1. Go to this page and download the library: Download jedrzej/pimpable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jedrzej / pimpable example snippets


class Post extends Eloquent {
    use PimpableTrait;
}

class PostsController extends Controller {
    public function index() {
        return Post::pimp()->get();
    }
}

class Model extends Eloquent {
    use PimpableTrait;
}

//override all parameters
return Model::pimp($filters, $sort, $relations)->get();

//override sorting criteria only
return Model::pimp(null, $sort)->get();

protected $sortParameterName = 'sortBy';

protected $withParameterName = 'relations';