I need to access to this id here is the code I used to displayed with dd()
JavaScript
x
Route::get('/', function () {
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']);
return new Filesystem($adapter);
});
$disk = Storage::disk('google');
$disk->put('abc.txt', "eyyyertr");
dd($disk);
///return view('welcome');
});
What I need is to get the variable I mentioned in the picture below, so I can delete the uploaded file with its own id
so far I tried :
JavaScript
$disk['driver']['adapter']
but it doens’t work, it gives me this Error
JavaScript
Cannot use object of type IlluminateFilesystemFilesystemAdapter as array
What should I do ?
Advertisement
Answer
Thank you, Apparently we must create getters on each class Here what worked for me
JavaScript
dd($disk->getDriver()->getAdapter()->getCacheFileObjectsByName()->id);
note each ‘get….()’ is written on used classes example: in FilesystemAdapter.php class
JavaScript
public function getDriver()
{
return $this->driver;
}
and the rest is the same.
also the ‘cacheFileObjectsByName’ was a private array, so the getter must be like so
JavaScript
public function getCacheFileObjectsByName()
{
return array_values($this->cacheFileObjectsByName)[0];
}
..thank you for your helps