'integer', 'quantity_received' => 'integer', 'unit_cost' => 'decimal:2', 'total_cost' => 'decimal:2', ]; public function purchaseOrder(): BelongsTo { return $this->belongsTo(PurchaseOrder::class); } public function part(): BelongsTo { return $this->belongsTo(Part::class); } public function getQuantityPendingAttribute(): int { return $this->quantity_ordered - $this->quantity_received; } public function getIsCompleteAttribute(): bool { return $this->quantity_received >= $this->quantity_ordered; } public function getIsPartialAttribute(): bool { return $this->quantity_received > 0 && $this->quantity_received < $this->quantity_ordered; } }