Build the stuff for payments.
This commit is contained in:
@@ -38,8 +38,6 @@ class Invoice extends Model
|
||||
|
||||
/**
|
||||
* Get the invoice state as translated string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocalizedStateAttribute(): string
|
||||
{
|
||||
@@ -56,35 +54,57 @@ class Invoice extends Model
|
||||
|
||||
/**
|
||||
* Get the created_at attribute in local time format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreatedAttribute(): string
|
||||
{
|
||||
return $this->created_at->format('d.m.Y');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user, that has created the invoice.
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice's customer.
|
||||
*/
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice's address.
|
||||
*/
|
||||
public function address(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Address::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice's delivery address.
|
||||
*/
|
||||
public function delivery(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Address::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items (invoice positions) of this invoice.
|
||||
*/
|
||||
public function items(): HasMany
|
||||
{
|
||||
return $this->hasMany(Invoiceitem::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payments for the invoice
|
||||
*/
|
||||
public function payments(): HasMany
|
||||
{
|
||||
return $this->hasMany(Payment::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user