You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

86 lines
2.1 KiB

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserAuth extends Model
{
//用户认证
protected $primaryKey = 'id';
protected $table = 'user_auth';
protected $guarded = [];
protected $appends = ['primary_status_text', 'status_text'];
protected $attributes = [
'status' => 0,
];
const STATUS_UNAUTH = 0;
const STATUS_WAIT = 1;
const STATUS_AUTH = 2;
const STATUS_REJECT = 3;
public static $statusMap = [
self::STATUS_UNAUTH => '高级未认证',
self::STATUS_WAIT => '待审核',
self::STATUS_AUTH => '已通过',
self::STATUS_REJECT => '已驳回',
//self::STATUS_JuniorUncertified => '初级未认证',
//self::STATUS_PrimaryCertificationPendingReview => '初级认证待审核',
//self::STATUS_PrimaryHasPassed => '初级已经通过',
//self::STATUS_PrimaryFailed => '初级未通过',
//self::STATUS_WAIT => '待审核',
//self::STATUS_AUTH => '已通过',
//self::STATUS_REJECT => '已驳回',
];
public static $enStatusMap = [
self::STATUS_UNAUTH => 'Advanced unauthenticated',
self::STATUS_WAIT => 'To be reviewed',
self::STATUS_AUTH => 'Passed',
self::STATUS_REJECT => 'Rejected',
];
public static $primaryStatusMap = [
0 => '初级未认证',
1 => '初级认证通过',
];
public static $typeMap = [
0 => "非营销号",
1 => "营销号",
];
public function getStatusTextAttribute()
{
return self::$statusMap[$this->status];
}
public function getPrimaryStatusTextAttribute()
{
return self::$primaryStatusMap[$this->primary_status];
}
public function getFrontImgAttribute($value)
{
return getFullPath($value);
}
public function getBackImgAttribute($value)
{
return getFullPath($value);
}
public function getHandImgAttribute($value)
{
return getFullPath($value);
}
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'user_id');
}
}