You can change the package behavior by updating the configuration file.
The configuration file can be found at config/datatables.php
.
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 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 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,
DataTables internal index id response column name.
'index_column' => 'DT_RowIndex',
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
],
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
],
Request key name to parse includes on fractal.
'includes' => 'include',
Default fractal serializer to be used when serializing the response.
'serializer' => League\Fractal\Serializer\DataArraySerializer::class,
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 pattern for Postgresql & Oracle.
{tip} For MySQL, use '-%s %s' as the sql pattern.
'nulls_last_sql' => '%s %s NULLS LAST',