hnhdigital-os / laravel-model-filter
1.0.14
2018-01-05 12:55 UTC
Requires
- php: >=7.0.0
- hnhdigital-os/laravel-frontend-asset-loader: ~1.0
- hnhdigital-os/laravel-html-generator: ~1.0
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- illuminate/database: 4.*|5.*
- phpunit/phpunit: 4.*
- symfony/process: ~2.3
README
提供设置过滤属性和模型关系过滤的能力。
此包由澳大利亚精品开发公司 H&H|Digital 开发。欢迎访问我们的网站 hnh.digital。
安装
通过 composer
$ composer require hnhdigital-os/laravel-model-filter ~1.0
使用方法
use HnhDigital\LaravelModelFilter\Traits\ModelTrait; class User extends Model { use ModelTrait; /** * A nice name for the model. * * @var array */ protected $filter_name = 'User'; /** * A list of relationships for this model. * * @var array */ protected $filter_relationships = [ 'Organization' => 'App\Models\Organization' ]; /** * A list of attributes that can be used for the advanced filtering trait. * * @var array */ protected $filter_attributes = [ 'lookup' => [ 'name' => 'Name or email', 'attribute' => ['first_name', 'last_name', 'email', 'organization.name'], 'filter' => 'string', 'search_tab_only' => true, 'with' => 'organization' ], 'first_name' => ['name' => 'First name', 'attribute' => 'first_name', 'filter' => 'string'], 'last_name' => ['name' => 'Last name', 'attribute' => 'last_name', 'filter' => 'string'], 'email' => ['name' => 'Email', 'attribute' => 'email', 'filter' => 'string'], 'is_active' => ['name' => 'Active user', 'attribute' => 'is_active', 'filter' => 'boolean'] ]; }
贡献
请参阅 CONTRIBUTING 了解详情。
致谢
许可协议
MIT 许可协议 (MIT)。请参阅 许可文件 了解更多信息。