39 lines
686 B
PHP
39 lines
686 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class LineItem extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'invoice_id',
|
|
'position',
|
|
'is_section',
|
|
'title',
|
|
'description',
|
|
'unit_id',
|
|
'quantity',
|
|
'price',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_section' => 'boolean',
|
|
'quantity' => 'integer',
|
|
'price' => 'decimal:2',
|
|
];
|
|
|
|
public function invoice()
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
public function unit()
|
|
{
|
|
return $this->belongsTo(Unit::class);
|
|
}
|
|
}
|