- 개소별 inspection_status를 검사 데이터 내용 기반으로 자동 판정 (15개 판정필드 + 사진 유무 → pending/in_progress/completed) - 문서 status를 개소 상태 집계로 자동 재계산 - inspectLocation, updateLocations 모두 적용 - QualityDocumentLocation에 STATUS_IN_PROGRESS 상수 추가 - transformToFrontend에 client_id 매핑 추가
65 lines
1.3 KiB
PHP
65 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_IN_PROGRESS = 'in_progress';
|
|
|
|
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;
|
|
}
|
|
}
|