【发布时间】:2021-09-21 16:43:30
【问题描述】:
我已经安装了
composer require nao-pon/flysystem-google-drive:~1.1 在我项目的根目录上。我也在我的 filesystems.php 中添加了这个
'google' => [
'driver' => 'google',
'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
'folderId' => env('GOOGLE_DRIVE_FOLDER_ID'),
]
此外,在我的 .env 中
GOOGLE_DRIVE_CLIENT_ID=xxx.apps.googleusercontent.com
GOOGLE_DRIVE_CLIENT_SECRET=xxx
GOOGLE_DRIVE_REFRESH_TOKEN=xxx
GOOGLE_DRIVE_FOLDER_ID=null
最后,在我的 app.php 中
App\Providers\GoogleDriveServiceProvider::class,
即使我已经全部设置,当我尝试使用这条路线时它仍然给我这个错误
Route::get('/test1', function() {
Storage::disk('google')->put('test.txt', 'Hello World');
});
我收到错误消息“不支持驱动程序 [google]。”
已编辑:
我的 GoogleDriveServiceProvider 上有这个
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}
【问题讨论】:
-
GoogleDriveServiceProvider中有什么内容?您需要在Storage上调用extend来添加驱动程序
标签: laravel google-drive-api service-provider