<?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');
    }

//    支持过的梦想
    public function systemInfo()
    {
        return $this->hasMany('App\Models\SystemInfoModel','other_id','id');
    }

}