Closed tobias-kuendig closed 6 years ago
I can't verify if this works, but I will gladly take your word for it. Thanks for the contribution 👍
Great! I had to upload files to a Team Drive and came across your example repo.
There is a problem with the current flysystem adapter that only allows files to be uploaded to the root directory of a team drive.
A PR with the fix got merged. Until a new version is released a temporary solution is to add the following lines before the return statement of the GoogleDriveServiceProvider
:
\Storage::extend('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'], ['teamDriveId' => $config['teamDriveId']]);
// Reset the pathPrefix and root back to your custom parent folder
$adapter->setPathPrefix($config['folderId']);
$adapter->root = $config['folderId'];
return new \League\Flysystem\Filesystem($adapter);
});
Ok, I will do a composer update when the fix gets tagged, so the lock file of the demo is up to date.
This PR adds support for storing files on Team Drives.