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 110
__construct(Model $model, Grid $grid = null)
Create a new grid model instance.
at line 126
Model
getOriginalModel()
No description
at line 136
Model
eloquent()
Get the eloquent model of the grid model.
at line 146
usePaginate(bool $use = true)
Enable or disable pagination.
at line 156
string
getPerPageName()
Get the query string variable used to store the per-page.
at line 168
$this
setPerPageName(string $name)
Set the query string variable used to store the per-page.
at line 180
int
getPerPage()
Get per-page number.
at line 192
$this
setPerPage(int $perPage)
Set per-page number.
at line 206
string
getSortName()
Get the query string variable used to store the sort.
at line 218
$this
setSortName(string $name)
Set the query string variable used to store the sort.
at line 230
Grid
getGrid()
Get parent gird instance.
at line 242
$this
setGrid(Grid $grid)
Set parent grid instance.
at line 252
Relation
getRelation()
No description
at line 262
$this
setRelation(Relation $relation)
No description
at line 274
array|bool
getConstraints()
Get constraints.
at line 292
$this
collection(Closure $callback = null)
Set collection callback.
at line 306
array|Collection|mixed
buildData(bool $toArray = true)
Build.
at line 332
bool
chunk(callable $callback, int $count = 100)
No description
at line 356
$this
addConditions(array $conditions)
Add conditions to grid model.
at line 370
string
getTable()
Get table of the model.
at line 378
Builder|Model
getQueryBuilder()
No description
at line 402
void
resetOrderBy()
Reset orderBy query.
at line 415
$this
__call(string $method, array $arguments)
No description
at line 432
bool
edit(mixed $id, string $field, string $value)
No description
at line 451
$this|Model
with(mixed $relations)
Set the relationships that should be eager loaded.
at line 485
mixed
__get($key)
No description
at line 499
protected Collection
get()
No description
at line 536
protected void
handleInvalidPage(LengthAwarePaginator $paginator)
If current page is greater than last page, then redirect to last page.
at line 551
protected void
setPaginate()
Set the grid paginate.
at line 582
protected array
resolvePerPage(array|null $paginate)
Resolve perPage for pagination.
at line 612
protected Model
findQueryByMethod($method)
Find query by method name.
at line 624
protected void
setSort()
Set the grid sort.
at line 667
protected void
setRelationSort(string $column)
Set relation sort.
at line 709
protected array
joinParameters(Relation $relation)
Build join parameters for related model.
HasOne
and BelongsTo
relation has different join parameters.
at line 743
static protected void
doNotSnakeAttributes(Model $model)
Don't snake case attributes.