36 lines
770 B
PHP
36 lines
770 B
PHP
<?php
|
|
|
|
namespace RuLong\Identity\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class IdentityLog extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'other' => 'array',
|
|
];
|
|
|
|
//
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(config('user_account.user_model'))->withDefault();
|
|
}
|
|
|
|
protected function getBeforeIdentityTitleAttribute()
|
|
{
|
|
return Identity::where('id', $this->before)->value('title') ?: '普通用户';
|
|
}
|
|
|
|
protected function getIdentityTitleAttribute()
|
|
{
|
|
return Identity::where('id', $this->after)->value('title') ?: '';
|
|
}
|
|
|
|
public function getChannelTextAttribute()
|
|
{
|
|
return config('rulong_identity.channel.' . $this->channel) ?? '无';
|
|
}
|
|
}
|