- 78개 MNG 전용 모델에 $connection = 'codebridge' 재적용 - config/database.php codebridge connection 포함
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models\DevTools;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* API 요청 로그 모델 (API 서버에서 기록된 실제 API 호출)
|
|
*
|
|
* @property int $id
|
|
* @property string $method
|
|
* @property string $url
|
|
* @property string|null $route_name
|
|
* @property array|null $request_headers
|
|
* @property array|null $request_body
|
|
* @property array|null $request_query
|
|
* @property int $response_status
|
|
* @property string|null $response_body
|
|
* @property int $duration_ms
|
|
* @property string|null $ip_address
|
|
* @property string|null $user_agent
|
|
* @property int|null $user_id
|
|
* @property int|null $tenant_id
|
|
* @property string|null $group_id
|
|
* @property \Carbon\Carbon $created_at
|
|
*/
|
|
class ApiRequestLog extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $table = 'api_request_logs';
|
|
|
|
protected $fillable = [
|
|
'method',
|
|
'url',
|
|
'route_name',
|
|
'request_headers',
|
|
'request_body',
|
|
'request_query',
|
|
'response_status',
|
|
'response_body',
|
|
'duration_ms',
|
|
'ip_address',
|
|
'user_agent',
|
|
'user_id',
|
|
'tenant_id',
|
|
'group_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'request_headers' => 'array',
|
|
'request_body' => 'array',
|
|
'request_query' => 'array',
|
|
'response_status' => 'integer',
|
|
'duration_ms' => 'integer',
|
|
'user_id' => 'integer',
|
|
'tenant_id' => 'integer',
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* URL에서 엔드포인트 경로 추출 (쿼리스트링 제외)
|
|
*/
|
|
public function getEndpointAttribute(): string
|
|
{
|
|
return parse_url($this->url, PHP_URL_PATH) ?? $this->url;
|
|
}
|
|
}
|