- 모델 3개: AiQuotationModule, AiQuotation, AiQuotationItem - AiQuotationService: Gemini/Claude 2단계 AI 파이프라인 - RdController: R&D 대시보드 + AI 견적 Blade 화면 - AiQuotationController: AI 견적 API (생성/목록/상세/재분석) - Blade 뷰: 대시보드, 목록, 생성, 상세, HTMX 테이블 - 라우트: /rd/* (web), /admin/rd/* (api)
65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Rd;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class AiQuotationItem extends Model
|
|
{
|
|
protected $table = 'ai_quotation_items';
|
|
|
|
protected $fillable = [
|
|
'ai_quotation_id',
|
|
'module_id',
|
|
'module_code',
|
|
'module_name',
|
|
'is_required',
|
|
'reason',
|
|
'dev_cost',
|
|
'monthly_fee',
|
|
'sort_order',
|
|
'options',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_required' => 'boolean',
|
|
'options' => 'array',
|
|
'dev_cost' => 'decimal:0',
|
|
'monthly_fee' => 'decimal:0',
|
|
];
|
|
|
|
public function quotation(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiQuotation::class, 'ai_quotation_id');
|
|
}
|
|
|
|
public function module(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AiQuotationModule::class, 'module_id');
|
|
}
|
|
|
|
public function getFormattedDevCostAttribute(): string
|
|
{
|
|
return number_format((int) $this->dev_cost).'원';
|
|
}
|
|
|
|
public function getFormattedMonthlyFeeAttribute(): string
|
|
{
|
|
return number_format((int) $this->monthly_fee).'원';
|
|
}
|
|
|
|
public function getOption(string $key, $default = null)
|
|
{
|
|
return data_get($this->options, $key, $default);
|
|
}
|
|
|
|
public function setOption(string $key, $value): void
|
|
{
|
|
$options = $this->options ?? [];
|
|
data_set($options, $key, $value);
|
|
$this->options = $options;
|
|
$this->save();
|
|
}
|
|
}
|