topnotch_website/app/Models/ScreenPrintEntry.php

45 lines
913 B
PHP
Raw Normal View History

2025-02-01 09:57:57 -08:00
<?php
namespace App\Models;
2025-02-01 09:57:57 -08:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
2025-02-01 09:57:57 -08:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ScreenPrintEntry extends Model
{
2025-02-01 09:57:57 -08:00
use HasFactory;
2025-02-01 09:57:57 -08:00
protected $fillable = [
'quote_id',
'quantity',
'logo',
'width',
'height',
'color_amount',
'setup_amount',
'run_charge',
'color_change',
'color_match',
'flash',
'fleece',
'poly_ink',
'other_charges',
'notes',
];
2025-02-01 09:57:57 -08:00
protected $appends = [
'total_price',
];
protected function getTotalPriceAttribute(): float
{
return $this->flash + $this->fleece + $this->poly_ink + $this->run_charge + $this->other_charges;
}
2025-02-01 09:57:57 -08:00
public function quote(): BelongsTo
{
return $this->belongsTo(Quote::class);
}
}