<?php
namespace app\model;

use think\Model;

/**
 * 商品模型
 * Class Goods
 * @package app\model
 */
class Goods extends Model{
    protected $autoWriteTimestamp = true;

    public function getStatusTextAttr($value,$data){
        $status = ['0'=>['text'=>'下架','style'=>'danger'],'1'=>['text'=>'上架','style'=>'success']];
        return $status[$data['status']] ;
    }

    public function cls() {
        return $this->hasOne(GoodsCls::class, 'id','cls_id');
    }
}
