简体   繁体   中英

Class 'Datatables' not found Laravel 5.4

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);
}

It's a typo. You set alias as DataTables but returned is Datatables .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM