| Total Complexity | 4 | 
| Total Lines | 26 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | trait WithFiles  | 
            ||
| 10 | { | 
            ||
| 11 | use Helpers;  | 
            ||
| 12 | |||
| 13 | public static function bootWithFiles(): void  | 
            ||
| 14 |     { | 
            ||
| 15 |         static::deleted(function ($model) { | 
            ||
| 16 | 4 |             $model->files->each(function ($file) { | 
            |
| 17 | 4 | $file->delete();  | 
            |
| 18 | 4 | });  | 
            |
| 19 | 6 | });  | 
            |
| 20 | 2 | }  | 
            |
| 21 | |||
| 22 | 6 | public function file(): MorphOne  | 
            |
| 23 |     { | 
            ||
| 24 | 6 |         return $this->morphOne(File::class, 'uploadable')->latest('id'); | 
            |
| 25 | }  | 
            ||
| 26 | |||
| 27 | 6 | public function files(): MorphMany  | 
            |
| 30 | }  | 
            ||
| 31 | |||
| 32 | 6 | public function bindFile(File $file, $extra = null): self  | 
            |
| 37 |