FileImg.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace App\Module\File\Model;
  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. public static $attrlist = array (
  34. 0 => 'id',
  35. 1 => 'storage_disk',
  36. 2 => 'path',
  37. 3 => 'user_id',
  38. 4 => 'admin_id',
  39. 5 => 're_type',
  40. 6 => 're_id',
  41. 7 => 'o_name',
  42. 8 => 'fsize',
  43. 9 => 'width',
  44. 10 => 'height',
  45. 11 => 'type1',
  46. 12 => 'updated_at',
  47. 13 => 'created_at',
  48. 14 => 'deleted_at',
  49. 15 => 'private',
  50. );
  51. //attrlist end
  52. protected $table = 'file_imgs';
  53. protected $appends =[
  54. 'url'
  55. ];
  56. public function getUrlAttribute()
  57. {
  58. return $this->getUrl();
  59. }
  60. public function getUrl()
  61. {
  62. return Img::getAdminPicUrl($this->path);
  63. }
  64. }