PHP code example of alvaro-canepa / oc-trait-scope-frontend
1. Go to this page and download the library: Download alvaro-canepa/oc-trait-scope-frontend 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/ */
alvaro-canepa / oc-trait-scope-frontend example snippets
class myModel extend Model {
use PlanetaDelEste\Traits\ScopeFrontendTrait;
...
}
/*
* @var array $sort 'column' key must be the model column to sort
* 'direction', accepted values: "asc", "desc"
*/
$sort = [
'column' => get('sort.column'),
'direction' => get('sort.direction')
];
/*
* @var array $filters key => value format, where key was used as column name,
* and value as search term.
*/
$filters = get('filters');
$collection = myModel::frontend($filters, $sort)->get();