ivanvermeyen / laravel-google-drive-demo

Laravel & Google Drive Storage - Demo project with Laravel 5.4
405 stars 155 forks source link

How to change folder id? #68

Closed afrasiyabhaider closed 5 years ago

afrasiyabhaider commented 5 years ago

I want to access multiple folders butfolderId is fixed in filesystem.php. How can I changefolder id when I want to access another Google Drive Folder?

ivanvermeyen commented 5 years ago

Hi,

The folder ID is being set in the ServiceProvider. The underlying GoogleDriveAdapter requires this. The ID is indeed fetched from the configuration file.

https://github.com/ivanvermeyen/laravel-google-drive-demo/blob/a545a75b15ac5b16d896a60854c46b5f0bce5300/app/Providers/GoogleDriveServiceProvider.php#L16-L31

One approach could be to use a root folder ID with some subfolders.

Another way is to tweak the code from the ServiceProvider a bit to accept a folder ID instead of using the one from the config. But I don't think you can use Laravel's extend functionality then. You'll have to create a custom class or function to do so.

afrasiyabhaider commented 5 years ago

I've created a function inside service provider class and then passed a value trough another class ro service provider

--Problem Solved--