Apply changes when creating invoices for projects.
All checks were successful
Build project image / Build-and-release-image (push) Successful in 3m9s
All checks were successful
Build project image / Build-and-release-image (push) Successful in 3m9s
This commit is contained in:
@@ -36,6 +36,7 @@ class Project extends Model
|
||||
'end',
|
||||
'customer_email',
|
||||
'customer_name',
|
||||
'next_invoice_count',
|
||||
];
|
||||
|
||||
|
||||
@@ -56,6 +57,14 @@ class Project extends Model
|
||||
return (is_null($this->start_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->start_date)->format('d.m.Y');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next invoice number for this project.
|
||||
*/
|
||||
public function getNextInvoiceCountAttribute(): int
|
||||
{
|
||||
return $this->invoices()->max('project_count') + 1 ?? 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end_date attribute in local format.
|
||||
*/
|
||||
@@ -72,6 +81,9 @@ class Project extends Model
|
||||
return $this->belongsTo(Customer::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoices for this project.
|
||||
*/
|
||||
public function invoices(): HasMany
|
||||
{
|
||||
return $this->hasMany(Invoice::class);
|
||||
|
||||
Reference in New Issue
Block a user