Total Complexity | 7 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class ExportStoredFile extends Model |
||
21 | { |
||
22 | use HasFactory; |
||
23 | |||
24 | protected $guarded = []; |
||
25 | |||
26 | protected $casts = [ |
||
27 | 'meta' => SimpleJsonField::class, |
||
28 | ]; |
||
29 | |||
30 | 9 | public function getTable(): string |
|
31 | { |
||
32 | 9 | return config('nova-resource-dynamic-export.tables.export_stored_files'); |
|
33 | } |
||
34 | |||
35 | 9 | protected static function boot(): void |
|
36 | { |
||
37 | 9 | parent::boot(); |
|
38 | |||
39 | 9 | self::deleting(function (self $model) { |
|
40 | 1 | $storage = Storage::disk($model->disk); |
|
41 | 1 | if ($storage->exists($model->path)) { |
|
42 | 1 | $storage->delete($model->path); |
|
43 | } |
||
44 | 9 | }); |
|
45 | } |
||
46 | |||
47 | 5 | public static function init(string $type, string $disk, string $path, string $name, ?\Closure $tap = null): static |
|
60 | } |
||
61 | |||
62 | 3 | public function downloadLink(): Attribute |
|
65 | } |
||
66 | |||
67 | 5 | protected static function newFactory(): ExportStoredFileFactory |
|
72 |