update request log
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
/**
|
||||
* API 请求日志模型
|
||||
*
|
||||
* 记录所有 HTTP 请求的基本信息、耗时和响应状态
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $user_id
|
||||
* @property string $method
|
||||
* @property string $path
|
||||
* @property int $status_code
|
||||
* @property string|null $ip
|
||||
* @property string|null $user_agent
|
||||
* @property array|null $request_body
|
||||
* @property int|null $response_code
|
||||
* @property int $duration_ms
|
||||
* @property \Carbon\Carbon $created_at
|
||||
*/
|
||||
class ApiRequestLog extends Model
|
||||
{
|
||||
protected ?string $table = 'api_request_logs';
|
||||
|
||||
public bool $timestamps = true;
|
||||
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
protected array $fillable = [
|
||||
'user_id', 'method', 'path', 'status_code', 'ip',
|
||||
'user_agent', 'request_body', 'response_code', 'duration_ms',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
'status_code' => 'integer',
|
||||
'response_code' => 'integer',
|
||||
'duration_ms' => 'integer',
|
||||
'request_body' => 'json',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user