DreamInfoModel.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. 'dream',
  33. 'about',
  34. 'money',
  35. 'time',
  36. 'get_money',
  37. 'mark',
  38. 'status'
  39. ];
  40. protected $hidden = ['score','created_at','deleted_at','id','sign','money','mark','get_money'];
  41. public function dreamUser()
  42. {
  43. return $this->belongsToMany('App\Models\UserInfoModel','user_dream','dream_id','user_id');
  44. }
  45. public function dreamFindUser()
  46. {
  47. return $this->belongsToMany('App\Models\UserInfoModel','user_dream','dream_id','user_id');
  48. }
  49. public function DreamInfo()
  50. {
  51. return $this->hasMany('App\Models\CommentInfoModel','dream_id','id');
  52. }
  53. public function dreamImgs()
  54. {
  55. return $this->hasMany('App\Models\DreamImages','dream_id','id');
  56. }
  57. public function dreamImgsFirst()
  58. {
  59. return $this->hasOne('App\Models\DreamImages','dream_id','id');
  60. }
  61. // 支持过的梦想
  62. public function systemInfo()
  63. {
  64. return $this->hasMany('App\Models\SystemInfoModel','other_id','id');
  65. }
  66. }