<?php

namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserAuth extends BaseModel
{
    use SoftDeletes;

    public function user()
    {
        return $this->belongsTo('App\Models\User', 'user_id');
    }
    public function project()
    {
        return $this->belongsTo('App\Models\Project', 'project_id');
    }

    public function project_role()
    {
        return $this->belongsTo('App\Models\ProjectRole', 'project_role_id');
    }

    public function getActive($type)
    {
        if($type == 'label') {
            return $this['active'] == 1 ? '<span class="layui-badge layui-bg-blue">通过</span>' : '<span class="layui-badge layui-bg-orange">待审核</span>';
        }
        return $this['active'];
    }
}
