31 lines
678 B
PHP
31 lines
678 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PurchaseOrderItem extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['purchase_order_id', 'item_id', 'quantity', 'rate', 'total_amount', 'quantity_received'];
|
|
|
|
protected $casts = [
|
|
'quantity' => 'decimal:2',
|
|
'rate' => 'decimal:2',
|
|
'total_amount' => 'decimal:2',
|
|
'quantity_received' => 'decimal:2',
|
|
];
|
|
|
|
public function purchaseOrder()
|
|
{
|
|
return $this->belongsTo(PurchaseOrder::class);
|
|
}
|
|
|
|
public function item()
|
|
{
|
|
return $this->belongsTo(Item::class);
|
|
}
|
|
}
|