*/ use HasFactory; public const CATEGORY_FILAMENT = 'filament'; public const CATEGORY_PACKAGING = 'packaging'; public const CATEGORY_SHIPPING = 'shipping'; /** @var list */ public const CATEGORIES = [self::CATEGORY_FILAMENT, self::CATEGORY_PACKAGING, self::CATEGORY_SHIPPING]; protected $fillable = [ 'cost_snapshot_id', 'category', 'description', 'quantity', 'quantity_unit', 'unit_rate', 'waste_quantity', 'units_per_parcel', 'line_total', 'source_price_date', 'source_reference', ]; protected function casts(): array { return [ 'quantity' => 'decimal:3', 'unit_rate' => 'decimal:6', 'waste_quantity' => 'decimal:3', 'units_per_parcel' => 'integer', 'line_total' => 'decimal:4', 'source_price_date' => 'date', ]; } public function snapshot(): BelongsTo { return $this->belongsTo(ProjectCostSnapshot::class, 'cost_snapshot_id'); } }