alvaro-canepa / oc-trait-scope-frontend
OctoberCMS 前端作用域特性
1.0.1
2019-08-26 21:26 UTC
Requires
This package is auto-updated.
Last update: 2024-09-27 08:46:02 UTC
README
OctoberCMS 前端作用域特性
安装
此包需要 PHP 7.2+ 并与 OctoberCMS 兼容。
在您的 composer.json
中添加此包
"require": {
...
"alvaro-canepa/oc-trait-scope-frontend": "~1.0",
},
用法示例
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();