54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Stock\ProductPackaging;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class GoodsReceiptLine extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'goods_receipt_id',
|
|
'product_id',
|
|
'packaging_id',
|
|
'packages_qty_received',
|
|
'units_qty_received',
|
|
'qty_received_base',
|
|
'unit_price',
|
|
'unit_price_per_package',
|
|
'tva_rate_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'packages_qty_received' => 'decimal:3',
|
|
'units_qty_received' => 'decimal:3',
|
|
'qty_received_base' => 'decimal:3',
|
|
'unit_price' => 'decimal:2',
|
|
'unit_price_per_package' => 'decimal:2',
|
|
];
|
|
|
|
public function goodsReceipt(): BelongsTo
|
|
{
|
|
return $this->belongsTo(GoodsReceipt::class);
|
|
}
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
|
|
public function packaging(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ProductPackaging::class);
|
|
}
|
|
|
|
public function tvaRate(): BelongsTo
|
|
{
|
|
return $this->belongsTo(TvaRate::class);
|
|
}
|
|
}
|