ComplaintModel.php 924 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * 投诉建议模型
  6. */
  7. class ComplaintModel extends Model
  8. {
  9. /**
  10. * 表名
  11. */
  12. protected $table = 'complaint';
  13. /**
  14. * 主键
  15. */
  16. protected $primaryKey = 'id';
  17. /**
  18. * 时间戳
  19. */
  20. public $timestamps = false;
  21. /**
  22. * 可批量赋值的属性
  23. */
  24. protected $fillable = [
  25. 'user_id',
  26. 'mobile',
  27. 'realname',
  28. 'content',
  29. 'albums',
  30. 'create_time',
  31. 'update_time',
  32. 'remark',
  33. 'status',
  34. 'mark'
  35. ];
  36. /**
  37. * 关联用户
  38. */
  39. public function user()
  40. {
  41. return $this->belongsTo(MemberModel::class, 'user_id', 'id');
  42. }
  43. // 图
  44. public function getThumbAttribute($value)
  45. {
  46. $value = $value ? get_format_images($value,'url', 'array') : [];
  47. return $value;
  48. }
  49. }