Configuration
By default, Tuner enables most features with minimal setup.
However, you can override the default behavior in your Eloquent models by defining specific configuration methods.
Projection
Define which fields are allowed for projection.
protected function getProjectableFields(): array
{
return ['*']; // Allow all fields
}
Sorting
Define which fields can be sorted.
protected function getSortableFields(): array
{
return ['*']; // Allow sorting on all fields
}
Search
Define which fields are searchable.
protected function getSearchableFields(): array
{
return ['*']; // Allow searching on all fields
}
Filtering
Define which fields are filterable.
protected function getFilterableFields(): array
{
return ['*']; // Allow filtering on all fields
}
Limiting
Control whether the model can be limited with the limit modifier.
protected function limitable(): bool
{
return true; // Enable limit for this model
}
Pagination
Control whether the model can use pagination with the per-page modifier.
protected function paginatable(): bool
{
return true; // Enable pagination for this model
}
Notes
- ['*'] means all fields are allowed.
- Replace ['*'] with an array of specific fields to restrict usage. Example:
protected function getSortableFields(): array
{
return ['id', 'name', 'created_at'];
}
- limitable() and paginatable() are simple on/off switches — return true to enable, false to disable.