<?php

namespace app\common\model;

class RecruitNewsModel extends BaseModel
{
    //设置表名
    protected $name = 'recruit_news';

    //自动完成
    protected $autoWriteTimestamp = true;

    //常量
    const STATUS = [1 => '已发布', 2 => '待修改'];

    const STATUS_PUBLISH = 1;
    const STATUS_MODIFY  = 2;


    public function getStatusTextAttr($value, $data)
    {
        return self::STATUS[$data['status']];
    }

    public function recruit()
    {
        return $this->hasOne(RecruitModel::class, "id", "recruit_id");
    }

    public function getSummaryAttr($value, $data)
    {
        return strip_tags($data['content']);
    }

    public function getUpdateShowAttr($value, $data)
    {
        return date('Y-m-d',($data['update_time']));
    }
}