After generating DataTables for the User model and navigating to the page, I get this error:
ReflectionException
Class App\DataTables\UserDataTable does not exist
To reproduce
Fresh install of adminlte-generator
php artisan infyom:scaffold User --fromTable --tableName=users --datatables=true
Load up the /users route
Cause
The generated UserDataTable class uses Yajra\DataTables\Services\DataTable - however, that class was extracted from DataTables into a new package which must be installed like so:
After generating DataTables for the User model and navigating to the page, I get this error:
To reproduce
adminlte-generator
php artisan infyom:scaffold User --fromTable --tableName=users --datatables=true
/users
routeCause
The generated
UserDataTable
class usesYajra\DataTables\Services\DataTable
- however, that class was extracted fromDataTables
into a new package which must be installed like so:Solution
composer require yajra/laravel-datatables-buttons:^4.0
Note for InfyOm Laravel Generator
Please also add this into the excellent documentation at https://labs.infyom.com/laravelgenerator/docs/7.0/generator-options for DataTables use.
I notice the generator is missing creating these files for DataTables, which
adminlte-generator
already has:resources/views/layouts/datatables_css.blade.php
resources/views/layouts/datatables_js.blade.php
The command
php artisan vendor:publish --tag=datatables-buttons
needs to be run so thatpublic/vendor/datatables/buttons.server-side.js
is available