fikri1510's avatar

Call to undefined method League\Flysystem\Filesystem::extends

I am trying to upload file to google drive. but got error, call to undefined method League\Flysystem\Filesystem::extends. My GoogleDriveServiceProvider looks like

use Illuminate\Support\ServiceProvider;
use Google_Client;
use Google_Service_Drive;
use Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter;
use Illuminate\Support\Facades\Storage;

public function boot()
    {
        Storage::extends('google', function ($app, $config) {
            $client = new Google_Client;
            $client->setClientId($config['clientId']);
            $client->setClientSecret($config['clientSecret']);
            $client->refreshToken($config['refreshToken']);
            $service = new Google_Service_Drive($client);
            $adapter = new GoogleDriveAdapter($service, $config['folderId']);
            $filesystem = new \League\Flysystem\Filesystem($adapter);
            return $filesystem;
        });
    }


I am using google/apiclient and neo pon Flysystem version 1.1. Why did I got that error?

0 likes
2 replies
siangboon's avatar
Level 54

not familiar with google drive api client... but the error seem like syntax error for Storage::extends, should be Storage::extend without "s"...

1 like
fikri1510's avatar

Ah, thank you. I didn't realize that extra 's' cause problem. Been spending hours trying to figure out what the problem was. Thanks again mr @siangboon

Please or to participate in this conversation.