- StoreRequest/UpdateRequest에 order_ids 검증 추가 - UpdateRequest에 locations 검증 추가 (시공규격, 변경사유, 검사데이터) - QualityDocumentLocation에 inspection_data(JSON) fillable/cast 추가 - QualityDocumentService store()에 syncOrders 연동 - QualityDocumentService update()에 syncOrders + updateLocations 연동 - inspection_data 컬럼 추가 migration 신규 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Qualitys;
|
|
|
|
use App\Models\Documents\Document;
|
|
use App\Models\Orders\OrderItem;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class QualityDocumentLocation extends Model
|
|
{
|
|
protected $table = 'quality_document_locations';
|
|
|
|
const STATUS_PENDING = 'pending';
|
|
|
|
const STATUS_COMPLETED = 'completed';
|
|
|
|
protected $fillable = [
|
|
'quality_document_id',
|
|
'quality_document_order_id',
|
|
'order_item_id',
|
|
'post_width',
|
|
'post_height',
|
|
'change_reason',
|
|
'inspection_data',
|
|
'document_id',
|
|
'inspection_status',
|
|
];
|
|
|
|
protected $casts = [
|
|
'inspection_data' => 'array',
|
|
];
|
|
|
|
public function qualityDocument()
|
|
{
|
|
return $this->belongsTo(QualityDocument::class);
|
|
}
|
|
|
|
public function qualityDocumentOrder()
|
|
{
|
|
return $this->belongsTo(QualityDocumentOrder::class);
|
|
}
|
|
|
|
public function orderItem()
|
|
{
|
|
return $this->belongsTo(OrderItem::class);
|
|
}
|
|
|
|
public function document()
|
|
{
|
|
return $this->belongsTo(Document::class);
|
|
}
|
|
|
|
public function isPending(): bool
|
|
{
|
|
return $this->inspection_status === self::STATUS_PENDING;
|
|
}
|
|
|
|
public function isCompleted(): bool
|
|
{
|
|
return $this->inspection_status === self::STATUS_COMPLETED;
|
|
}
|
|
}
|