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;
|
||
|
|
}
|
||
|
|
}
|