class QueryModel extends Query

Constants

protected NAME_PAGESIZE

protected NAME_PAGE

protected OBJECT_MASK

Properties

int $pagesize 分页数量 from  Query
int $usePaginate 是否使用分页 from  Query
protected int $total 分页总长度 from  Query
protected Closure $collectionCallback

对查询出来的数据集合进行回调, 参数是查询的所有数据

from  Query
protected Model $model

Eloquent model instance of the grid model.

protected Model $origin
protected Collection $queries

Array of queries of the eloquent model.

protected array|string $sort

Sort parameters of the model.

protected Relation $relation
protected array $eagerLoads

Methods

usePaginate(bool $paginate = true)

启用或者禁用分页

from  Query
int
total()

获取当前模型的总数

from  Query
collection(Closure $callback = null)

Set collection callback.

from  Query
__construct(Model $model)

Create a new grid model instance.

Collection
get()

组建数据

mixed
chunk(Closure $closure, int $amount = 100)

No description

prepare(FilterPlugin $filter, TablePlugin $table)

查询条件预取

bool
edit($id, string $field, $value)

No description

mixed
getPrimaryKey()

No description

usePrimaryKey(array $ids = [])

No description

$this
__call(string $method, array $arguments)

调用查询方法并把参数放入到查询条件中

Collection
fetchData()

No description

void
setPaginate()

设置分页

array
resolvePagesize(array|null $paginate)

Resolve pagesize for pagination.

array|null
findQueryByMethod(string $method)

通过方法名称查找组合模型的条件

void
setSort()

设置排序 _sort { column : type : cast : }

void
setRelationSort(string $column)

Set relation sort.

array|null
joinParameters(Relation $relation)

Build join parameters for related model.

Details

in Query at line 49
Queryable usePaginate(bool $paginate = true)

启用或者禁用分页

Parameters

bool $paginate

Return Value

Queryable

in Query at line 60
int total()

获取当前模型的总数

Return Value

int

in Query at line 72
Queryable collection(Closure $callback = null)

Set collection callback.

Parameters

Closure $callback

Return Value

Queryable

at line 74
__construct(Model $model)

Create a new grid model instance.

Parameters

Model $model

at line 87
Collection get()

组建数据

Return Value

Collection

Exceptions

Exception

at line 104
mixed chunk(Closure $closure, int $amount = 100)

No description

Parameters

Closure $closure
int $amount

Return Value

mixed

Exceptions

Exception

at line 128
Queryable prepare(FilterPlugin $filter, TablePlugin $table)

查询条件预取

Parameters

FilterPlugin $filter
TablePlugin $table

Return Value

Queryable

Exceptions

ApplicationException

at line 140
bool edit($id, string $field, $value)

No description

Parameters

$id
string $field
$value

Return Value

bool

at line 155
mixed getPrimaryKey()

No description

Return Value

mixed

at line 164
Queryable usePrimaryKey(array $ids = [])

No description

Parameters

array $ids

Return Value

Queryable

at line 176
$this __call(string $method, array $arguments)

调用查询方法并把参数放入到查询条件中

Parameters

string $method
array $arguments

Return Value

$this

at line 189
protected Collection fetchData()

No description

Return Value

Collection

Exceptions

Exception

at line 216
protected void setPaginate()

设置分页

Return Value

void

at line 243
protected array resolvePagesize(array|null $paginate)

Resolve pagesize for pagination.

Parameters

array|null $paginate

Return Value

array

at line 269
protected array|null findQueryByMethod(string $method)

通过方法名称查找组合模型的条件

Parameters

string $method

Return Value

array|null

method : paginate arguments : [15]

at line 285
protected void setSort()

设置排序 _sort { column : type : cast : }

Return Value

void

at line 328
protected void setRelationSort(string $column)

Set relation sort.

Parameters

string $column

Return Value

void

Exceptions

Exception

at line 370
protected array|null joinParameters(Relation $relation)

Build join parameters for related model.

HasOne and BelongsTo relation has different join parameters.

Parameters

Relation $relation

Return Value

array|null

Exceptions

Exception