'array', 'request_body' => 'array', 'response_headers' => 'array', 'response_status' => 'integer', 'duration_ms' => 'integer', ]; /** * 사용자 관계 */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * 최근순 정렬 스코프 */ public function scopeLatest($query) { return $query->orderByDesc('created_at'); } /** * HTTP 메서드 배지 색상 */ public function getMethodColorAttribute(): string { return match (strtoupper($this->method)) { 'GET' => 'green', 'POST' => 'blue', 'PUT' => 'yellow', 'PATCH' => 'orange', 'DELETE' => 'red', default => 'gray', }; } /** * 응답 상태 코드 색상 */ public function getStatusColorAttribute(): string { return match (true) { $this->response_status >= 200 && $this->response_status < 300 => 'green', $this->response_status >= 300 && $this->response_status < 400 => 'blue', $this->response_status >= 400 && $this->response_status < 500 => 'yellow', $this->response_status >= 500 => 'red', default => 'gray', }; } /** * 성공 여부 */ public function getIsSuccessAttribute(): bool { return $this->response_status >= 200 && $this->response_status < 300; } }