| Total Complexity | 8 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class FileUpload extends Model |
||
| 11 | { |
||
| 12 | use HasFactory, SoftDeletes; |
||
| 13 | |||
| 14 | protected $table = "file_uploads"; |
||
| 15 | |||
| 16 | protected $fillable = [ |
||
| 17 | 'ref', |
||
| 18 | 'name', |
||
| 19 | 'file_name', |
||
| 20 | 'size', |
||
| 21 | 'extension', |
||
| 22 | 'disk', |
||
| 23 | 'mime_type', |
||
| 24 | 'path', |
||
| 25 | 'relative_path', |
||
| 26 | 'url', |
||
| 27 | 'folder', |
||
| 28 | 'hashed', |
||
| 29 | ]; |
||
| 30 | |||
| 31 | protected $casts = [ |
||
| 32 | 'hashed' => 'boolean' |
||
| 33 | ]; |
||
| 34 | |||
| 35 | protected function getFileNameAttribute($value) |
||
| 36 | { |
||
| 37 | if ($this->hashed) { |
||
| 38 | return Crypt::decryptString($value); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $value; |
||
| 42 | } |
||
| 43 | |||
| 44 | protected function getPathAttribute($value) |
||
| 45 | { |
||
| 46 | if ($this->hashed) { |
||
| 47 | return Crypt::decryptString($value); |
||
| 48 | } |
||
| 49 | |||
| 50 | return $value; |
||
| 51 | } |
||
| 52 | |||
| 53 | |||
| 54 | protected function getRelativePathAttribute($value) |
||
| 61 | } |
||
| 62 | |||
| 63 | protected function getUrlAttribute($value) |
||
| 70 | } |
||
| 71 | |||
| 72 | } |
||
| 73 |