MIF_E31222707/Modules/StockTransfer/Entities/StockTransferItem.php

44 lines
945 B
PHP

<?php
namespace Modules\StockTransfer\Entities;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Product\Entities\Product;
use App\Models\ProductBatch;
class StockTransferItem extends Model
{
use HasFactory;
protected $fillable = [
'stock_transfer_id',
'product_id',
'product_batch_id',
'destination_batch_id',
'qty',
'unit_price',
'price'
];
protected $casts = [
'qty' => 'integer',
'unit_price' => 'decimal:2',
'price' => 'decimal:2'
];
public function stockTransfer()
{
return $this->belongsTo(StockTransfer::class);
}
public function product()
{
return $this->belongsTo(Product::class);
}
public function productBatch()
{
return $this->belongsTo(ProductBatch::class);
}
}