Files
HickLab3D_Dashboard/app/Models/ProjectCostLine.php
T
hermes d4928789c4
Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Add HL3D branding, Etsy Live/Draft paging and Projects lifecycle
Replace the old touchmark/PNG identity with the supplied lockup and
monogram, segmented role-aware navigation, Live/Draft listing filters
with generation-based cache invalidation, and admin Projects covering
immutable file revisions, listing live pointers, and exact-decimal
filament/packaging/shipping costing. Additive schema only; no Etsy
publication. Isolated clone tests: 301 tests, 1162 assertions.
2026-11-08 12:50:56 +00:00

46 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Database\Factories\ProjectCostLineFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProjectCostLine extends Model
{
/** @use HasFactory<ProjectCostLineFactory> */
use HasFactory;
public const CATEGORY_FILAMENT = 'filament';
public const CATEGORY_PACKAGING = 'packaging';
public const CATEGORY_SHIPPING = 'shipping';
/** @var list<string> */
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');
}
}