DreamInfoModel.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace App\Models;
  3. use App\Models\BaseModel;
  4. /**
  5. * @description dfghfdhfgfghfg
  6. * @author system;
  7. * @version 1.0
  8. * @date 2017-06-01 05:20:51
  9. *
  10. */
  11. class DreamInfoModel extends BaseModel
  12. {
  13. /**
  14. * 数据表名
  15. *
  16. * @var string
  17. *
  18. */
  19. protected $table = 'dream_info';
  20. /**
  21. 主键
  22. */
  23. protected $primaryKey = 'id';
  24. //分页
  25. protected $perPage = PAGE_NUMS;
  26. /**
  27. * 可以被集体附值的表的字段
  28. *
  29. * @var string
  30. */
  31. protected $fillable = [
  32. 'name',
  33. 'about',
  34. 'coin',
  35. 'time',
  36. 'get_coin',
  37. 'mark',
  38. 'parameter',
  39. 'code',
  40. 'add_care_number',
  41. 'status'
  42. ];
  43. protected $hidden = ['deleted_at'];
  44. public function user()
  45. {
  46. return $this->hasOne('App\Models\UserInfoModel','id','user_id');
  47. }
  48. public function imgs()
  49. {
  50. return $this->hasMany('App\Models\DreamImages','dream_id');
  51. }
  52. public function img()
  53. {
  54. return $this->hasOne('App\Models\DreamImages','dream_id','id');
  55. }
  56. // 系统消息
  57. public function systemInfo()
  58. {
  59. return $this->hasMany('App\Models\SystemInfoModel','other_id','id');
  60. }
  61. public function interactions()
  62. {
  63. return $this->hasMany('App\Models\InteractionInfo','dream_id');
  64. }
  65. public function allInteraction()
  66. {
  67. return $this->hasManyThrough('App\Models\CommentInfoModel', 'App\Models\InteractionInfo','dream_id','interaction_id');
  68. }
  69. public function meet()
  70. {
  71. return $this->hasOne('App\Models\MeetInfoModel','dream_id');
  72. }
  73. }