laravel-datatables: Class 'Yajra\Datatables\Facades\Datatables' not found
Hello, Why i get this error :
Class 'Yajra\Datatables\Facades\Datatables' not found
Cause i never update anything.
My app.php is :
Yajra\Datatables\DatatablesServiceProvider::class,
'Datatables' => Yajra\Datatables\Datatables::class,
How to fix that?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 32 (5 by maintainers)
@shairozan, the Facade file was removed on v6.0 and an alias was automatically registered in the service provider. You need to replace this
use Yajra\Datatables\Facades\Datatables
to justuse Datatables
or useYajra\Datatables\Datatables
instead for better IDE support.@idmeneo sorry for the inconvenience. What are steps have you done so far? Are using a fresh installation or upgrading a project?
Some tips:
composer show
to double check which version of packages you are using.bootstrap/cache
folder as suggested by @RBBarani.vendor
folder and reinstall all packages usingcomposer install
.– Edit – “yajra” and “Yajra” namespace is a bit old issue from v5.x and below and I think is irrelevant on v7. Thanks!
On v8, Run
composer update
and use this namespaceuse Yajra\DataTables\Facades\DataTables;
Namespace and class name were updated on v8. Use DataTables instead of Datatables.
That worked
@wisnuvb Namespace and class name were updated on v8. Use
DataTables
instead ofDatatables
. See upgrade guide for ref.just delete all files inside a bootstrap->cache folder. And run your project. Bug fixed.
dev-develop
usesYajra\Datatables
namespace which will be tagged as v6.0.0. For the facade, please use'Datatables' => Yajra\Datatables\Datatables::class,
atm.Change follwoing
to this
and try.
This is use Yajra\DataTables\Facades\DataTables; working fine from my side thanks
Changing from v6.0 to v8.0 forced me to change config/app.php frro
to
and it worked fine afterwards.
Also, if used to automatically un-escape html elements, you’d have to publish the vendor package and change config/datatables.php
to
I use composer require yajra/laravel-datatables-oracle command and change below line yajra\Datatables\DatatablesServiceProvider::class, ‘Datatables’ => yajra\Datatables\Datatables::class, It,s working. Something like this https://appdividend.com/2018/04/16/laravel-datatables-tutorial-with-example/
Thx for the answer. I finally got it working by downgrading your module to v6.2 and updating all the other libraries.
Yajra\DataTables\DataTablesServiceProvider::class, in providers array Yajra\DataTables\Facades\DataTables::class, in aliases array
use this one, it solved the issue for me
Use this:
‘Datatables’ => Yajra\DataTables\Facades\DataTables::class, // Datatable
D and T should be capital.
@victorsteven’s solution worked on a fresh Laravel 5.6 + Datatables 8.7.0
@lexxyungcarter please see upgrade guide for ref.