'array', 'path_params' => 'array', 'query_params' => 'array', 'body' => 'array', 'is_shared' => 'boolean', ]; /** * 사용자 관계 */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * 공유된 템플릿 스코프 */ public function scopeShared($query) { return $query->where('is_shared', true); } /** * 특정 엔드포인트의 템플릿 스코프 */ public function scopeForEndpoint($query, string $endpoint, string $method) { return $query->where('endpoint', $endpoint)->where('method', $method); } /** * HTTP 메서드 배지 색상 */ public function getMethodColorAttribute(): string { return match (strtoupper($this->method)) { 'GET' => 'green', 'POST' => 'blue', 'PUT' => 'yellow', 'PATCH' => 'orange', 'DELETE' => 'red', default => 'gray', }; } }