Storage S3 deleteDirectory Not Working? Digging in to the docs and looking at the filesystem it looks like there is a function called deleteDirectory but when I try and use it, it does not work.
http://laravel.com/api/5.0/Illuminate/Contracts/Filesystem/Cloud.html#method_deleteDirectory
Is this a working function?
Here is my code:
public function destroy($id)
{
// Remove property photos from AWS S3
if(Storage::disk('s3')->exists('property/' . $id))
{
Storage::disk('s3')->deleteDirectory('property/' . $id);
}
}
Ok it was how I was doing my if statement, the following worked:
public function destroy($id)
{
// Remove property photos from AWS S3
if(count(Storage::disk('s3')->exists('property/' . $id)) > 0)
{
Storage::disk('s3')->deleteDirectory('property/' . $id);
}
}
Please sign in or create an account to participate in this conversation.