<?php
/**
* @author 龙虾 <15108148@qq.com>
* @copyright 睿谷信息 <www.rgxx.com>
* @todo 自定义模型类
*/
namespace app\common\model;
use think\Model;
use app\common\model\Site;
use think\model\concern\SoftDelete;

class Blockmodel extends Model
{
	use SoftDelete;
	protected $defaultSoftDelete = 0;
	protected $json = ['extend'];
    protected $jsonAssoc = true;

    public function getCreateTimeAttr($value)
    {
        return date("Y-m-d H:i:s",intval($value));
    }
    public function getUpdateTimeAttr($value)
    {
        return date("Y-m-d H:i:s",intval($value));
    }
    public function getDeleteTimeAttr($value)
    {
        return date("Y-m-d H:i:s",intval($value));
    }
	// 关联站点
	public function site()
	{
		return $this->belongsTo('Site');
	}
	// 关联管理员
	public function admin()
	{
		return $this->belongsTo('Admin')->field(['password','salt'],true);
	}
	// 关联模型
	public function cmsmodels()
	{
		return $this->belongsTo('Cmsmodels');
	}
}