DataTables warning: table id=vendors – Ajax error. For more information about this error, please see http://datatables.net/tn/7

By | October 30, 2018
Questions:

I am using laravel 5.4 and php version is 5.6.

I am getting error “Class ‘Datatables’ not found”. I am following standard procedure. I have installed datatable using composer by following command:

composer require yajra/laravel-datatables-oracle:"~7.0"

I added these two lines in config->app file in service provider and aliases:

Yajra\DataTables\DataTablesServiceProvider::class,
'DataTables' => Yajra\DataTables\Facades\DataTables::class,

then publish package :

php artisan vendor:publish --provider=Yajra\DataTables\DataTablesServiceProvider

I am using raw query here is my controller code :

function allvendor(){

$sql="my query";
$results=DB::table(DB::raw("($sql)"));
return Datatables::of($results)->make(true);
}
Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *