Closed codetestmg closed 7 years ago
Try updating to the latest version then force publish the assets again:
php artisan vendor:publish --tag=datatables --force
I am getting same error
i have installed latest version from https://yajrabox.com/docs/laravel-datatables/7.0
composer require yajra/laravel-datatables-oracle:^7.0
added in config/app.php Yajra\Datatables\DatatablesServiceProvider::class,
After completing the step above, use the following command to publish configuration & assets:
php artisan vendor:publish --tag=datatables
ERROR Exception in Datatables.php line 52: No available engine for Illuminate\Database\Eloquent\Collection
Duplicate https://github.com/yajra/laravel-datatables/issues/1003. Make sure you are using the latest version and republish assets.
Config should look something like:
<?php
return [
/**
* DataTables search options.
*/
'search' => [
/**
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"
*/
'smart' => true,
/**
* Case insensitive will search the keyword in lower case format.
* SQL: LOWER(column) LIKE LOWER(keyword)
*/
'case_insensitive' => true,
/**
* Wild card will add "%" in between every characters of the keyword.
* SQL: column LIKE "%k%e%y%w%o%r%d%"
*/
'use_wildcards' => false,
],
/**
* DataTables internal index id response column name.
*/
'index_column' => 'DT_Row_Index',
/**
* DataTables fractal configurations.
*/
'fractal' => [
/**
* Request key name to parse includes on fractal.
*/
'includes' => 'include',
/**
* Default fractal serializer.
*/
'serializer' => League\Fractal\Serializer\DataArraySerializer::class,
],
/**
* Datatables 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,
],
/**
* Datatables accepted builder to engine mapping.
*/
'builders' => [
Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
Illuminate\Database\Eloquent\Builder::class => 'eloquent',
Illuminate\Database\Query\Builder::class => 'query',
Illuminate\Support\Collection::class => 'collection',
],
/**
* Nulls last sql pattern for Posgresql & Oracle.
* For MySQL, use '-%s %s'
*/
'nulls_last_sql' => '%s %s NULLS LAST',
];
i have following config file
<?php
return [
/**
* DataTables search options.
*/
'search' => [
/**
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"
*/
'smart' => true,
/**
* Case insensitive will search the keyword in lower case format.
* SQL: LOWER(column) LIKE LOWER(keyword)
*/
'case_insensitive' => true,
/**
* Wild card will add "%" in between every characters of the keyword.
* SQL: column LIKE "%k%e%y%w%o%r%d%"
*/
'use_wildcards' => false,
],
/**
* DataTables internal index id response column name.
*/
'index_column' => 'DT_Row_Index',
/**
* DataTables fractal configurations.
*/
'fractal' => [
/**
* Request key name to parse includes on fractal.
*/
'includes' => 'include',
/**
* Default fractal serializer.
*/
'serializer' => League\Fractal\Serializer\DataArraySerializer::class,
],
/**
* Datatables 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,
],
/**
* Datatables accepted builder to engine mapping.
*/
'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',
],
/**
* Nulls last sql pattern for Posgresql & Oracle.
* For MySQL, use '-%s %s'
*/
'nulls_last_sql' => '%s %s NULLS LAST',
];
Hmm, can you try updating the config like below?
'builders' => [
Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
Illuminate\Database\Eloquent\Builder::class => 'eloquent',
Illuminate\Database\Query\Builder::class => 'query',
Illuminate\Support\Collection::class => 'collection',
Illuminate\Database\Eloquent\Collection => 'collection',
],
BTW, your config is not updated to the latest version and you might also be using 7.0 instead of 7.1++
Try checking your package version using composer show
THANKS A LOT @yajra for helping me to fix the issue. i have installed now latest version
composer require yajra/laravel-datatables-oracle:^7.2
Now its working fine.Also Thanks for this wonderfull library
I am using laravel 5.4 . i have following code if i try to pass model all then i am getting error
return Datatables::of(Brand::all()) ->make(true);
Error: Exception in Datatables.php line 52: No available engine for Illuminate\Database\Eloquent\Collection
if i use return Datatables::of(DB::table('brands'))->make(true); ite working fine.is ther any setting is reuired to work for eloquent