General Settings
Introduction
You can change the package behavior by updating the configuration file.
The configuration file can be found at config/datatables.php
.
Smart Search
Smart search will enclose search keyword with wildcard string "%keyword%"
.
The sql generated will be like column LIKE "%keyword%"
when set to true
.
'smart' => true,
Case Sensitive Search
Case insensitive will search the keyword in lower case format.
The sql generated will be like LOWER(column) LIKE LOWER(keyword)
when set to true
.
'case_insensitive' => true,
Wild Card Search
Wild card will add %
in between every characters of the keyword.
The sql generated will be like column LIKE "%k%e%y%w%o%r%d%"
when set to true
.
'use_wildcards' => false,
Index Column
DataTables internal index id response column name.
'index_column' => 'DT_RowIndex',
Engines
A list of available engines. This is where you can register your custom datatables engine.
'engines' => [ 'eloquent' => Yajra\DataTables\Engines\EloquentEngine::class, 'query' => Yajra\DataTables\Engines\QueryBuilderEngine::class, 'collection' => Yajra\DataTables\Engines\CollectionEngine::class, // add your custom engine ],
Builders
A list of accepted data source / builders of datatables with their corresponding engine handler.
'builders' => [ Illuminate\Database\Eloquent\Relations\HasMany::class => 'eloquent', Illuminate\Database\Eloquent\Builder::class => 'eloquent', Illuminate\Database\Query\Builder::class => 'query', Illuminate\Support\Collection::class => 'collection', // add your data source to custom engine handler ],
Fractal Includes
Request key name to parse includes on fractal.
'includes' => 'include',
Fractal Serializer
Default fractal serializer to be used when serializing the response.
'serializer' => League\Fractal\Serializer\DataArraySerializer::class,
Script Template
DataTables html builder script blade template.
If published, the file will installed on resources/views/vendor/datatables/script.blade.php
.
'script_template' => 'datatables::script',
NULLS LAST sql
Nulls last sql pattern for Postgresql & Oracle.
{tip} For MySQL, use '-%s %s' as the sql pattern.
'nulls_last_sql' => '%s %s NULLS LAST',