laravel-google-cloud-storage
laravel-google-cloud-storage copied to clipboard
Driver [gcs] is not supported.
I am trying to access last modified date of a particular file:
$disk = Storage::disk('gcs');
$info = $disk->lastModified('file.jpg');
And I am getting the error I mentioned in title.
I am Using following version for libraries:
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/horizon": "^4.3",
"laravel/tinker": "^2.0",
"predis/predis": "^1.1",
"sentry/sentry-laravel": "^1.8",
"superbalist/laravel-google-cloud-storage": "^2.2.3"
And I have configured filesystems.php
as mentioned below:
'disks' => [
'gcs' => [
'driver' => 'gcs',
'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'),
'key_file' => env('GOOGLE_CLOUD_KEY_FILE', public_path('production.json')), // optional: /path/to/service-account.json
'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'),
'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null), // optional: /default/path/to/apply/in/bucket
'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below
'visibility' => 'public', // optional: public|private
],
]
I have tried clearing cache and config
php artisan config:clear
php artisan cache:clear
It still doesn't work.
What am I doing wrong? Am I missing anything?
Looks like the package Service Provider isn't being loaded.
Have you tried running php artisan package:discover
or manually registering the Service Provider in config/app.php
under
'providers' => [
...
]
composer dump-autoload
should also trigger the php artisan package:discover
Same issue here. When running artisan package:discover
I get the following:
Discovered Package: superbalist/laravel-google-cloud-storage
Package manifest generated successfully.
After manually adding the service provider to config/app.php
it works.
Seems like a composer related issue. It was not registering the package. It did work before. After installing the lib again it worked...