<?php

namespace Kylin\LawCase\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 操作日志模型
 *
 * 记录系统操作日志，用于审计追踪。
 *
 * @property string $module      操作模块
 * @property string $action      操作动作
 * @property string $target_type 目标类型
 * @property int    $target_id   目标ID
 */
class OperationLog extends Model
{
    protected $table = 'kylin_law_operation_logs';

    public $timestamps = false;

    protected $fillable = [
        'user_id',
        'module',
        'action',
        'target_type',
        'target_id',
        'ip_address',
        'request_data',
        'created_at',
    ];

    protected $casts = [
        'request_data' => 'array',
        'created_at' => 'datetime',
    ];

    public function user()
    {
        return $this->belongsTo(\App\Models\User::class);
    }
}
