<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/22
 * Time: 11:49
 */

namespace app\common\model;


class Comment extends BaseModel
{
    protected $table = 'mr_user_comments';
//    关联查询用户
    public function user()
    {
        return $this->belongsTo('User','uid','id');
    }
//    关联查询商品
    public function project(){
        return $this->belongsTo('Project','pid','id');
    }
//    处理状态
    public function getStatusStrAttr($value,$data){
        $status = array(
            '1'=>['color'=>'#c33eff','name'=>'审核中'],
            '2'=>['color'=>'#4acc2e ','name'=>'审核通过'],
            '3'=>['color'=>'#cc2e2e','name'=>'审核失败']
        );
        return $status[$data['status']];
    }
}