mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
v5.0.0 update
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace Crater\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crater\Traits\HasCustomFieldsTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@ -10,21 +11,10 @@ use Illuminate\Support\Facades\DB;
|
||||
class InvoiceItem extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasCustomFieldsTrait;
|
||||
|
||||
protected $fillable = [
|
||||
'invoice_id',
|
||||
'name',
|
||||
'item_id',
|
||||
'description',
|
||||
'company_id',
|
||||
'quantity',
|
||||
'price',
|
||||
'discount_type',
|
||||
'discount_val',
|
||||
'total',
|
||||
'tax',
|
||||
'discount',
|
||||
'unit_name',
|
||||
protected $guarded = [
|
||||
'id'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
@ -51,6 +41,11 @@ class InvoiceItem extends Model
|
||||
return $this->hasMany(Tax::class);
|
||||
}
|
||||
|
||||
public function recurringInvoice()
|
||||
{
|
||||
return $this->belongsTo(RecurringInvoice::class);
|
||||
}
|
||||
|
||||
public function scopeWhereCompany($query, $company_id)
|
||||
{
|
||||
$query->where('company_id', $company_id);
|
||||
|
||||
Reference in New Issue
Block a user