Reputation: 27
I am need to clear all my storage
files , I am try this :
Route::get('/clear/storage', function () {
$file = new Filesystem;
$file->cleanDirectory('storage/app');
return show_message(true, 'clear successfully');
});
and this is my storage :
how could I do that to clear all fills ?
Upvotes: 0
Views: 136
Reputation: 1816
You can do it by this:
use Illuminate\Support\Facades\File;
Route::get('/clear/storage', function () {
File::cleanDirectory(storage_path('/'));
return show_message(true, 'clear successfully');
});
Upvotes: 1
Reputation: 109
You can try this code
$getAllFilesInPath = scandir('storage/app');
Storage::delete($getAllFilesInPath);
Upvotes: 0