laravel 找不到“Yajra\DataTables\DatatablesServiceProvider”类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46725300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Class 'Yajra\DataTables\DatatablesServiceProvider' not found
提问by Lee Daniel
I've developed Laravel Project in my local computer. I used Yajra Pakagebox for using bootstrap datatables on it.
我在本地计算机上开发了 Laravel 项目。我使用 Yajra Pakagebox 在其上使用引导数据表。
Like this : composer require yajra/laravel-datatables-oracle php artisan vendor:publish
像这样: 作曲家需要 yajra/laravel-datatables-oracle php artisan vendor:publish
Then I pushed them all into Hosting Server but it displays errors like below.
然后我将它们全部推送到托管服务器,但它显示如下错误。
(1/1) FatalThrowableError
Class 'Yajra\DataTables\DatatablesServiceProvider' not found
in ProviderRepository.php (line 208)
at ProviderRepository->createProvider('Yajra\DataTables\DatatablesServiceProvider')
in ProviderRepository.php (line 144)
at ProviderRepository->compileManifest(array('Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Notifications\NotificationServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Yajra\DataTables\DatatablesServiceProvider', 'Laravel\Tinker\TinkerServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider'))
in ProviderRepository.php (line 61)
The important thing is I can't execute any command on Hosting Server because it is Shared Hosting Server. I saw many articles for solving this problem but they are all using "artisan" and "composer" command. But I can't use this command at all. I can only upload the source code to server with FTP.
重要的是我无法在托管服务器上执行任何命令,因为它是共享托管服务器。我看过很多解决这个问题的文章,但他们都使用“工匠”和“作曲家”命令。但是我根本不能使用这个命令。我只能使用 FTP 将源代码上传到服务器。
回答by shuadoc
Depending on what version of DataTables you are using, it may be simple capitalization issue. After version 8 you should use:
根据您使用的 DataTables 版本,这可能是简单的大小写问题。在版本 8 之后,您应该使用:
Yajra\DataTables\DataTablesServiceProvider
Before version 8 use:
在版本 8 之前使用:
Yajra\Datatables\DatatablesServiceProvider
Upgrade notes reference: https://yajrabox.com/docs/laravel-datatables/master/upgrade#namespace
升级注意事项参考:https: //yajrabox.com/docs/laravel-datatables/master/upgrade#namespace
回答by Priya
It is working for [email protected]
它适用于 [email protected]
Yajra\DataTables\DataTablesServiceProvider::class,
'Datatables' => Yajra\DataTables\Facades\DataTables::class,
回答by AddWeb Solution Pvt Ltd
Please run below command and try:
请运行以下命令并尝试:
composer update
composer dump-autoload
php artisan config:cache
php artisan cache:clear
回答by Lars Mertens
Try below steps to resolve this issue:
尝试以下步骤来解决此问题:
- Use composer show to check which version of packages you are using.
- Delete all files under bootstrap/cache folder
- Delete vendor folder and reinstall all packages using composer install.
- 使用 composer show 检查您正在使用的软件包版本。
- 删除 bootstrap/cache 文件夹下的所有文件
- 删除供应商文件夹并使用 composer install 重新安装所有软件包。
回答by Qh0stM4N
all the files you know you're changing to ftp (migrations config controller...)
您知道要更改为 ftp 的所有文件(迁移配置控制器...)
and replaced local files to server with ftp
并使用 ftp 将本地文件替换为服务器
/composer.json
/composer.lock
/bootstrap/*
/storage/framework/cache/*
/storage/framework/views/*
/vendor/composer/*
/vendor/autoload.php
If the problem persists, I'm need to relay the version of the Laravel. Tested with
如果问题仍然存在,我需要中继 Laravel 的版本。测试过
php artisan --version
Laravel Framework 5.4.19
回答by Rayees Pk
Re install with the plugin along with the buttons plugin and now it's working. composer require yajra/laravel-datatables-buttons:^3.0
重新安装插件和按钮插件,现在它可以工作了。作曲家需要 yajra/laravel-datatables-buttons:^3.0
回答by Rafid Shahriar
In your [config/app.php] file, edit the aliases array. Change it from
在您的 [config/app.php] 文件中,编辑别名数组。改变它从
'Datatables' => Yajra\Datatables\Facades\Datatables::class
to
到
'Datatables' => Yajra\Datatables\DatatablesServiceProvider::class
回答by Soliman Mahmoud Soliman
replace Datatables
with DataTables
替换Datatables
为DataTables