Closed fakhri-m closed 3 years ago
Route::get('share', function () { $filename = 'tes.docx'; // Store a demo file Storage::cloud()->put($filename, ''); // Get the file to find the ID $dir = '/'; $recursive = false; // Get subdirectories also? $contents = collect(Storage::cloud()->listContents($dir, $recursive)); $file = $contents ->where('type', '=', 'file') ->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME)) ->where('extension', '=', pathinfo($filename, PATHINFO_EXTENSION)) ->first(); // there can be duplicate file names! // Change permissions // - https://developers.google.com/drive/v3/web/about-permissions // - https://developers.google.com/drive/v3/reference/permissions $service = Storage::cloud()->getAdapter()->getService(); $permission = new \Google_Service_Drive_Permission(); $permission->setRole('writer'); $permission->setType('anyone'); $permission->setAllowFileDiscovery(false); $permissions = $service->permissions->create($file['basename'], $permission); return Storage::cloud()->url($file['path']); });
i use this format and change role from reader to writer, and testing it with another gmail account to access it but it just in 'reader mode'
i alr check it in activity
and here the details in the drive( i try to use .txt too and same problem)
its changed alr, any solution?
i use this format and change role from reader to writer, and testing it with another gmail account to access it but it just in 'reader mode'
i alr check it in activity
and here the details in the drive( i try to use .txt too and same problem)
its changed alr, any solution?