<?php

namespace App\Models;

use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @description 信息列表
 * @author  system;
 * @version    1.0
 * @date 2018-07-11 06:50:54
 *
 */
class MessagesInfoModel extends BaseModel
{
    use SoftDeletes;
    /**
     * 数据表名
     *
     * @var string
     *
     */
    protected $table = 'messages_info';
    /**
     * 主键
     */
    protected $primaryKey = 'id';

    //分页
    protected $perPage = PAGE_NUMS;

    /**
     * 可以被集体附值的表的字段
     *
     * @var string
     */
    protected $fillable = [
        'site_id',
        'title',
        'content',
        'user_id',
        'price',
        'phone',
        'comment',
        'type',
        'sort',
        'pic_url'
    ];

    public function tags()
    {
        return $this->belongsToMany('App\Models\MessagesTagModel', 'messages_tag_relation', 'messages_id', 'tag_id');
    }

}