dikkco / build-query
model query for orm.
0.0.3
2020-12-12 03:45 UTC
Requires
- php: >=7.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-12 12:33:44 UTC
README
🌈 use for build query.
Environment
- PHP >= 7.1
Installation
$ composer require dikkco/build-query
QuickStart
- Common filter
use Dikkco\Buildable\Constant; use Dikkco\Buildable\Buildable; $this->param($params ?? []) ->initial(['initial' => 0]) ->key('avatar') ->key('name', Constant::RIGHT) ->key('name', Constant::ALL) ->inKey('type') ->betweenKey('created_at', ['start' => 'create', 'end' => 'end']) ->beforeKey('id') ->afterKey('id') ->unsetKey('initial') ->sort('created_at') ->result();
- Get order
use Dikkco\Buildable\Buildable; $order = $this ->param(array_merge(['update_time' => 'desc'], $params)) //默认更新时间排序 ->sort(['update_time', 'a.update_time']) //更新时间 ->sort(['id', 'a.id']) //ID ->sort('create_time') ->order();