Car-Repairs-Shop/app/Models/EstimateLineItem.php
sackey e839d40a99
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Initial commit
2025-07-30 17:15:50 +00:00

49 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class EstimateLineItem extends Model
{
use HasFactory;
protected $fillable = [
'estimate_id',
'type', // 'labor', 'parts', 'miscellaneous'
'part_id',
'description',
'quantity',
'unit_price',
'total_amount',
'labor_hours',
'labor_rate',
'markup_percentage',
'notes',
'required',
'category',
];
protected $casts = [
'quantity' => 'decimal:2',
'unit_price' => 'decimal:2',
'total_amount' => 'decimal:2',
'labor_hours' => 'decimal:2',
'labor_rate' => 'decimal:2',
'markup_percentage' => 'decimal:2',
'required' => 'boolean',
];
public function estimate(): BelongsTo
{
return $this->belongsTo(Estimate::class);
}
public function part(): BelongsTo
{
return $this->belongsTo(Part::class);
}
}