This commit is contained in:
2024-03-17 12:30:19 +01:00
commit c805b5ebaa
133 changed files with 24036 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Console\Commands;
use App\Models\TemporaryUpload;
use Illuminate\Console\Command;
use Storage;
class TemporaryClear extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'temporary:clear';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Temporary uploads clear';
/**
* Execute the console command.
*/
public function handle()
{
$uploads = TemporaryUpload::where('created_at', '<', now()->subHour())->get();
foreach ($uploads as $upload) {
Storage::disk('public')->delete($upload->path);
$upload->delete();
}
}
}