Files
pingan_new/packages/identity/src/Models/UserIdentity.php
2020-08-06 16:42:18 +08:00

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 "";
}
}
}