39 lines
792 B
PHP
39 lines
792 B
PHP
<?php
|
|
|
|
namespace RuLong\Identity\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class UserIdentity extends Model
|
|
{
|
|
protected $primaryKey = 'user_id';
|
|
public $incrementing = false;
|
|
protected $guarded = [];
|
|
|
|
public function info()
|
|
{
|
|
return $this->belongsTo(Identity::class, 'identity_id');
|
|
}
|
|
|
|
public function logs()
|
|
{
|
|
return $this->hasMany(IdentityLog::class, 'user_id', 'user_id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(config('user_account.user_model'))->withDefault();
|
|
}
|
|
|
|
public function getEmptyTextAttribute()
|
|
{
|
|
$info = IdentityLog::where('channel', 'EmptyUp')->first();
|
|
if ($info) {
|
|
return "是";
|
|
} else {
|
|
return "否";
|
|
}
|
|
}
|
|
|
|
}
|