44 lines
916 B
PHP
44 lines
916 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class PurchaseOrderLine extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'purchase_order_id',
|
|
'product_id',
|
|
'description',
|
|
'quantity',
|
|
'unit_price',
|
|
'tva_rate',
|
|
'discount_pct',
|
|
'total_ht',
|
|
];
|
|
|
|
protected $casts = [
|
|
'quantity' => 'decimal:3',
|
|
'unit_price' => 'decimal:2',
|
|
'tva_rate' => 'decimal:2',
|
|
'discount_pct' => 'decimal:2',
|
|
'total_ht' => 'decimal:2',
|
|
];
|
|
|
|
public function purchaseOrder(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PurchaseOrder::class);
|
|
}
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
}
|