first commit
This commit is contained in:
16
app/Models/ApprovalWorkflow.php
Normal file
16
app/Models/ApprovalWorkflow.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ApprovalWorkflow extends Model
|
||||
{
|
||||
protected $casts = ['steps' => 'array'];
|
||||
|
||||
public function getCurrentStep(Document $document)
|
||||
{
|
||||
$lastApproval = $document->approvals()->latest()->first();
|
||||
return $lastApproval ? $this->steps[$lastApproval->step_index + 1] : $this->steps[0];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user