chore: update document approval workflow and bug fixes
This commit is contained in:
46
Modules/ApprovalWorkflow/app/Models/ApprovalStep.php
Normal file
46
Modules/ApprovalWorkflow/app/Models/ApprovalStep.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ApprovalWorkflow\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Traits\HasPublicIdentifier;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\ApprovalWorkflow\Enums\ApprovalStepStatus;
|
||||
|
||||
class ApprovalStep extends Model
|
||||
{
|
||||
use HasPublicIdentifier;
|
||||
|
||||
protected $fillable = [
|
||||
'approval_chain_id',
|
||||
'approver_id',
|
||||
'order',
|
||||
'status',
|
||||
'notes',
|
||||
'acted_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => ApprovalStepStatus::class,
|
||||
'acted_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function chain(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ApprovalChain::class, 'approval_chain_id');
|
||||
}
|
||||
|
||||
public function approver(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approver_id');
|
||||
}
|
||||
|
||||
public function isPending(): bool
|
||||
{
|
||||
return $this->status === ApprovalStepStatus::Pending;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user