Model
class Model
Properties
protected Model | $model | Eloquent model instance of the grid model. |
|
protected Model | $originalModel | ||
protected Collection | $queries | Array of queries of the eloquent model. |
|
protected array | $sort | Sort parameters of the model. |
|
protected array | $data | ||
protected | $perPage | ||
protected bool | $usePaginate | If the model use pagination. |
|
protected string | $perPageName | The query string variable used to store the per-page. |
|
protected string | $sortName | The query string variable used to store the sort. |
|
protected Closure | $collectionCallback | Collection callback. |
|
protected Grid | $grid | ||
protected Relation | $relation | ||
protected array | $eagerLoads |
Methods
No description
Get the eloquent model of the grid model.
Enable or disable pagination.
Get the query string variable used to store the per-page.
Set the query string variable used to store the per-page.
Get per-page number.
Set per-page number.
Get the query string variable used to store the sort.
Set the query string variable used to store the sort.
No description
No description
Get constraints.
Build.
No description
Add conditions to grid model.
Get table of the model.
No description
Reset orderBy query.
No description
No description
No description
No description
If current page is greater than last page, then redirect to last page.
Set the grid paginate.
Resolve perPage for pagination.
Find query by method name.
Set the grid sort.
Set relation sort.
Build join parameters for related model.
Don't snake case attributes.
Details
at line 109
__construct(Model $model, Grid $grid = null)
Create a new grid model instance.
at line 125
Model
getOriginalModel()
No description
at line 135
Model
eloquent()
Get the eloquent model of the grid model.
at line 145
usePaginate(bool $use = true)
Enable or disable pagination.
at line 155
string
getPerPageName()
Get the query string variable used to store the per-page.
at line 167
$this
setPerPageName(string $name)
Set the query string variable used to store the per-page.
at line 179
int
getPerPage()
Get per-page number.
at line 191
$this
setPerPage(int $perPage)
Set per-page number.
at line 205
string
getSortName()
Get the query string variable used to store the sort.
at line 217
$this
setSortName(string $name)
Set the query string variable used to store the sort.
at line 229
Grid
getGrid()
Get parent gird instance.
at line 241
$this
setGrid(Grid $grid)
Set parent grid instance.
at line 251
Relation
getRelation()
No description
at line 261
$this
setRelation(Relation $relation)
No description
at line 273
array|bool
getConstraints()
Get constraints.
at line 291
$this
collection(Closure $callback = null)
Set collection callback.
at line 305
array|Collection|mixed
buildData(bool $toArray = true)
Build.
at line 331
bool
chunk(callable $callback, int $count = 100)
No description
at line 355
$this
addConditions(array $conditions)
Add conditions to grid model.
at line 369
string
getTable()
Get table of the model.
at line 377
Builder|Model
getQueryBuilder()
No description
at line 401
void
resetOrderBy()
Reset orderBy query.
at line 414
$this
__call(string $method, array $arguments)
No description
at line 431
bool
edit(mixed $id, string $field, string $value)
No description
at line 450
$this|Model
with(mixed $relations)
Set the relationships that should be eager loaded.
at line 484
mixed
__get($key)
No description
at line 498
protected Collection
get()
No description
at line 535
protected void
handleInvalidPage(LengthAwarePaginator $paginator)
If current page is greater than last page, then redirect to last page.
at line 550
protected void
setPaginate()
Set the grid paginate.
at line 581
protected array
resolvePerPage(array|null $paginate)
Resolve perPage for pagination.
at line 611
protected Model
findQueryByMethod($method)
Find query by method name.
at line 623
protected void
setSort()
Set the grid sort.
at line 666
protected void
setRelationSort(string $column)
Set relation sort.
at line 708
protected array
joinParameters(Relation $relation)
Build join parameters for related model.
HasOne
and BelongsTo
relation has different join parameters.
at line 742
static protected void
doNotSnakeAttributes(Model $model)
Don't snake case attributes.