You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

19 lines
383 B

<?php
namespace App\Domains\System\Actions\Files;
use App\Domains\System\Models\File;
class RemoveModelFile
{
public function execute(string $model, string|int $id): void
{
$files = File::where('fileable_id', $id)
->where('fileable_type', $model)
->get();
foreach ($files as $file) {
$file->delete();
}
}
}