FileImg.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Module\File\Models;
  3. use App\Module\File\Img;
  4. use UCore\ModelCore;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. /**
  7. * 图片文件
  8. *
  9. * field start
  10. * @property int $id
  11. * @property string $storage_disk 储存 disk
  12. * @property string $path 储存目录
  13. * @property int $user_id 用户iD
  14. * @property int $admin_id 管理员ID
  15. * @property string $re_type 关联类型
  16. * @property int $re_id 关联ID
  17. * @property string $o_name 原名
  18. * @property int $fsize 文件大小
  19. * @property int $width 图片宽度
  20. * @property string $height 图片高度
  21. * @property string $type1 图片类型
  22. * @property \Carbon\Carbon $updated_at
  23. * @property \Carbon\Carbon $created_at
  24. * @property \Carbon\Carbon $deleted_at
  25. * @property int $private 私人的; 0:公共的 ,1 私人的
  26. * field end
  27. *
  28. */
  29. class FileImg extends \UCore\ModelCore
  30. {
  31. use SoftDeletes;
  32. // attrlist start
  33. protected $fillable = [
  34. 'id',
  35. 'storage_disk',
  36. 'path',
  37. 'user_id',
  38. 'admin_id',
  39. 're_type',
  40. 're_id',
  41. 'o_name',
  42. 'fsize',
  43. 'width',
  44. 'height',
  45. 'type1',
  46. 'private',
  47. ];
  48. // attrlist end
  49. protected $table = 'file_imgs';
  50. protected $appends =[
  51. 'url'
  52. ];
  53. public function getUrlAttribute()
  54. {
  55. return $this->getUrl();
  56. }
  57. public function getUrl()
  58. {
  59. return Img::getAdminPicUrl($this->path);
  60. }
  61. }