afoysal's avatar

Class 'Yajra\DataTables\DataTablesServiceProvider' not found

I am working in a Server where I can't run any SSH command.

I worked on my localhost and installed DataTable using composer require yajra/laravel-datatables-oracle:"~9.0". After completion of Development I uploaded some files and portion of files through cPanel.

I placed Yajra\DataTables\DataTablesServiceProvider::class, in Providers array and 'DataTables' => Yajra\DataTables\Facades\DataTables::class, in Alias array.

I uploaded datatables.php file in config folder.

Now I am getting Class 'Yajra\DataTables\DataTablesServiceProvider' not found error when I am trying to run the application.

0 likes
7 replies
Sinnbeck's avatar

Did you remeber to run composer install on production?

1 like
afoysal's avatar

Thanks @sinnbeck . I run composer install in my local machine. But I can't run any SSH command in my Server. I can upload files to Server through cPanel.

Project is running perfectly in my local machine.

Thanks.

Sinnbeck's avatar

So you uploaded your vendor folder as well?

1 like
afoysal's avatar

Thanks @sinnbeck . Yes, I uploaded vendor folder also which is yajra folder. Thanks.

Sinnbeck's avatar

Yes but I am not sure how to help. Try checking if the file is there in the vendor folder perhaps?

Or perhaps try uploading all of your local files again and overwrite

ygupta's avatar

For someone who still face this issue.

In your controller file where you import the Facade, instead of Facade you need

use Yajra\Datatables\DataTables;

This is the correct way of importing the required class, and then use it like below

return DataTables:: ... ->make(true);

Please or to participate in this conversation.