Files
sam-api/app/Models/Materials/NonconformingReportItem.php

46 lines
985 B
PHP
Raw Normal View History

<?php
namespace App\Models\Materials;
use App\Models\Items\Item;
use App\Traits\BelongsToTenant;
use App\Traits\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class NonconformingReportItem extends Model
{
use BelongsToTenant, ModelTrait;
protected $fillable = [
'tenant_id',
'nonconforming_report_id',
'item_id',
'item_name',
'specification',
'quantity',
'unit_price',
'amount',
'sort_order',
'remarks',
'options',
];
protected $casts = [
'options' => 'array',
'quantity' => 'decimal:2',
'unit_price' => 'integer',
'amount' => 'integer',
];
public function report(): BelongsTo
{
return $this->belongsTo(NonconformingReport::class, 'nonconforming_report_id');
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}