| 1 | <?php namespace Modules\Media\Entities; |
||
| 12 | class File extends Model |
||
| 13 | { |
||
| 14 | use Translatable; |
||
| 15 | /** |
||
| 16 | * All the different images types where thumbnails should be created |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | private $imageExtensions = ['jpg', 'png', 'jpeg', 'gif']; |
||
| 20 | |||
| 21 | protected $table = 'media__files'; |
||
| 22 | public $translatedAttributes = ['description', 'alt_attribute', 'keywords']; |
||
| 23 | protected $fillable = [ |
||
| 24 | 'description', |
||
| 25 | 'alt_attribute', |
||
| 26 | 'keywords', |
||
| 27 | 'filename', |
||
| 28 | 'path', |
||
| 29 | 'extension', |
||
| 30 | 'mimetype', |
||
| 31 | 'width', |
||
| 32 | 'height', |
||
| 33 | 'filesize', |
||
| 34 | 'folder_id', |
||
| 35 | ]; |
||
| 36 | protected $appends = ['path_string']; |
||
| 37 | |||
| 38 | public function getPathAttribute($value) |
||
| 42 | |||
| 43 | public function getPathStringAttribute() |
||
| 47 | |||
| 48 | public function isImage() |
||
| 52 | |||
| 53 | public function getThumbnail($type) |
||
| 61 | } |
||
| 62 |