mengatasi masalah Class "Masbug\Flysystem\GoogleDrive\GoogleDriveAdapter" not found
- Buka file
providers/GoogleDriveServiceProvider.php
. - Cari baris berikut:
$adapter = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter;
- Ganti
Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter
denganMasbug\Flysystem\GoogleDriveAdapter
. - Simpan file
providers/GoogleDriveServiceProvider.php
.
Setelah Anda mengganti adapter, Anda perlu menghapus cache Laravel dengan menjalankan perintah berikut:
php artisan cache:clear
Setelah cache dihapus, Anda dapat menggunakan adapter Google Drive yang baru.
Berikut adalah contoh lengkap dari file providers/GoogleDriveServiceProvider.php
setelah mengganti adapter Google Drive:
PHP
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Masbug\Flysystem\GoogleDrive\GoogleDriveAdapter;
use League\Flysystem\Filesystem;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->app->singleton('google-drive', function () {
$adapter = new GoogleDriveAdapter(
[
'client_id' => env('GOOGLE_DRIVE_CLIENT_ID'),
'client_secret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
'refresh_token' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
]
);
return new Filesystem($adapter);
});
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}