2025-12-27 18:50:37 +09:00
|
|
|
<?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;
|
|
|
|
|
|
feat: [database] codebridge DB 분리 - 118개 MNG 전용 테이블 connection 설정
- config/database.php에 codebridge connection 추가
- 78개 MNG 전용 모델에 $connection = 'codebridge' 설정
- Admin (15): PM, 로드맵, API Explorer
- Sales (16): 영업파트너, 수수료, 가망고객
- Finance (9): 법인카드, 자금관리, 홈택스
- Barobill (12): 은행/카드 동기화 관리
- Interview (1), ESign (6), Equipment (2)
- AI (3), Audit (3), 기타 (11)
2026-03-07 11:27:18 +09:00
|
|
|
protected $connection = 'codebridge';
|
2025-12-27 18:50:37 +09:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|