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.
54 lines
957 B
54 lines
957 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AdminOperationLog extends Model
|
|
{
|
|
|
|
/**
|
|
* 可批量赋值的属性
|
|
* @var array
|
|
*/
|
|
protected $fillable
|
|
= [
|
|
'user_id',
|
|
'action',
|
|
'model_type',
|
|
'model_id',
|
|
'ip',
|
|
'description',
|
|
'old_values',
|
|
'new_values',
|
|
];
|
|
|
|
/**
|
|
* 属性类型转换
|
|
* @var array
|
|
*/
|
|
protected $casts
|
|
= [
|
|
'old_values' => 'json',
|
|
'new_values' => 'json',
|
|
];
|
|
|
|
protected $table = 'admin_operation_log';
|
|
|
|
/**
|
|
* 获取进行此操作的用户
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* 获取关联的模型
|
|
*/
|
|
public function model()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
}
|
|
|