49 lines
970 B
PHP
49 lines
970 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class InvoiceLine extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'invoice_id',
|
|
'product_id',
|
|
'packaging_id',
|
|
'packages_qty',
|
|
'units_qty',
|
|
'description',
|
|
'qty_base',
|
|
'unit_price',
|
|
'unit_price_per_package',
|
|
'tva_rate_id',
|
|
'discount_pct',
|
|
'total_ht',
|
|
];
|
|
|
|
public function invoice()
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
|
|
public function packaging()
|
|
{
|
|
return $this->belongsTo(\App\Models\Stock\ProductPackaging::class, 'packaging_id');
|
|
}
|
|
|
|
public function tvaRate()
|
|
{
|
|
return $this->belongsTo(\App\Models\TvaRate::class, 'tva_rate_id');
|
|
}
|
|
}
|