123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Models;
- use App\Models\BaseModel;
- /**
- * @description dfghfdhfgfghfg
- * @author system;
- * @version 1.0
- * @date 2017-06-01 05:20:51
- *
- */
- class DreamInfoModel extends BaseModel
- {
- /**
- * 数据表名
- *
- * @var string
- *
- */
- protected $table = 'dream_info';
- /**
- 主键
- */
- protected $primaryKey = 'id';
- //分页
- protected $perPage = PAGE_NUMS;
- /**
- * 可以被集体附值的表的字段
- *
- * @var string
- */
- protected $fillable = [
- 'dream',
- 'about',
- 'money',
- 'time',
- 'get_money',
- 'mark',
- 'status'
- ];
- public function dreamUser()
- {
- return $this->belongsToMany('App\Models\UserInfoModel','user_dream','user_id','dream_id');
- }
- public function dreamFindUser()
- {
- return $this->belongsToMany('App\Models\UserInfoModel','user_dream','dream_id','user_id');
- }
- public function DreamInfo()
- {
- return $this->hasMany('App\Models\CommentInfoModel','dream_id','id');
- }
- public function dreamImgs()
- {
- return $this->hasMany('App\Models\dreamImages','dream_id','id');
- }
- public function dreamImgsFirst()
- {
- return $this->hasOne('App\Models\dreamImages','dream_id','id');
- }
- }
|