DreamInfoModel.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. public function dreamUser()
  41. {
  42. return $this->belongsToMany('App\Models\UserInfoModel','user_dream','user_id','dream_id');
  43. }
  44. public function dreamFindUser()
  45. {
  46. return $this->belongsToMany('App\Models\UserInfoModel','user_dream','dream_id','user_id');
  47. }
  48. public function DreamInfo()
  49. {
  50. return $this->hasMany('App\Models\CommentInfoModel','dream_id','id');
  51. }
  52. public function dreamImgs()
  53. {
  54. return $this->hasMany('App\Models\DreamImages','dream_id','id');
  55. }
  56. public function dreamImgsFirst()
  57. {
  58. return $this->hasOne('App\Models\DreamImages','dream_id','id');
  59. }
  60. // 支持过的梦想
  61. public function systemInfo()
  62. {
  63. return $this->hasMany('App\Models\SystemInfoModel','other_id','id');
  64. }
  65. }