50 lines
976 B
PHP
50 lines
976 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AvoirLine extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'avoir_id',
|
|
'product_id',
|
|
'invoice_line_id',
|
|
'description',
|
|
'quantity',
|
|
'unit_price',
|
|
'tva_rate',
|
|
'total_ht',
|
|
'total_tva',
|
|
'total_ttc',
|
|
'notes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'quantity' => 'decimal:3',
|
|
'unit_price' => 'decimal:4',
|
|
'tva_rate' => 'decimal:2',
|
|
'total_ht' => 'decimal:2',
|
|
'total_tva' => 'decimal:2',
|
|
'total_ttc' => 'decimal:2',
|
|
];
|
|
|
|
public function avoir()
|
|
{
|
|
return $this->belongsTo(Avoir::class);
|
|
}
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
|
|
public function invoiceLine()
|
|
{
|
|
return $this->belongsTo(InvoiceLine::class);
|
|
}
|
|
}
|