停车场管理系统
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.
 
 

78 lines
1.6 KiB

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use JetBrains\PhpStorm\ArrayShape;
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';
protected $hidden = [
'updated_at'
];
/**
* 获取进行此操作的用户
*/
public function user()
{
return $this->belongsTo(User::class);
}
/**
* 获取关联的模型
*/
public function model()
{
return $this->morphTo();
}
/**
* @return string[]
*/
#[ArrayShape(['login' => "string",
'logout' => "string",
'create' => "string",
'update' => "string",
'delete' => "string"
])] public static function getActionArr(): array
{
return [
'login' => __('admin.login'),
'logout' => __('admin.logout'),
'create' => __('admin.new'),
'update' => __('admin.edit'),
'delete' => __('admin.delete')
];
}
}