Operation processes on invoices
This commit is contained in:
@@ -29,13 +29,13 @@ class CostUnit extends InstancedModel
|
||||
'archived',
|
||||
];
|
||||
|
||||
public function tresurers() : BelongsToMany{
|
||||
public function treasurers() : BelongsToMany{
|
||||
return $this->belongsToMany(User::class, 'cost_unit_treasurers', 'cost_unit_id', 'user_id')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function resetTreasurers() {
|
||||
$this->tresurers()->detach();
|
||||
$this->treasurers()->detach();
|
||||
$this->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enumerations\InvoiceStatus;
|
||||
use App\Enumerations\InvoiceType;
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
@@ -75,4 +76,8 @@ class Invoice extends InstancedModel
|
||||
public function status() : BelongsTo {
|
||||
return $this->belongsTo(InvoiceStatus::class, 'status')->first();
|
||||
}
|
||||
|
||||
public function invoiceType() : InvoiceType {
|
||||
return $this->belongsTo(InvoiceType::class, 'type', 'slug')->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user