Build the stuff for incoming invoices.

This commit is contained in:
2025-01-21 11:49:56 +01:00
parent e16324249a
commit 0e712a3412
24 changed files with 1495 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -31,6 +32,41 @@ class Incoming extends Model
'pay_iban',
];
/**
* The attributes that are appended with attribute getters.
*
* @var string[]
*/
protected $appends = [
'created',
'paid',
'due',
];
/**
* Get the pay_date attribute in local time format.
*/
public function getDueAttribute(): string
{
return (is_null($this->due_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->due_date)->format('d.m.Y');
}
/**
* Get the pay_date attribute in local time format.
*/
public function getPaidAttribute(): string
{
return (is_null($this->pay_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->pay_date)->format('d.m.Y');
}
/**
* Get the issue_date attribute in local time format.
*/
public function getCreatedAttribute(): string
{
return Carbon::createFromFormat('Y-m-d', $this->issue_date)->format('d.m.Y');
}
/**
* Get the supplier of the incoming invoice.
*/