Skip to content

Commit e0bbc0d

Browse files
committed
Fix
1 parent 1186ff2 commit e0bbc0d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Models/WorkflowModelStatus.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Foundation\Auth\User;
1212
use Squarebit\Workflows\Contracts\Workflowable;
1313
use Squarebit\Workflows\Traits\BelongsToWorkflow;
14+
use function Pest\Laravel\instance;
1415

1516
/**
1617
* @property Model $model
@@ -58,11 +59,11 @@ public function status(): BelongsTo
5859

5960
public function scopeInStatus(Builder $query, int|WorkflowStatus $status): Builder
6061
{
61-
return $query->where('workflow_status_id', $status);
62+
return $query->where('workflow_status_id', $status instanceof WorkflowStatus ? $status->getKey() : $status);
6263
}
6364

6465
public function scopeForWorkflow(Builder $query, int|Workflow $workflow): Builder
6566
{
66-
return $query->where('workflow_id', $workflow);
67+
return $query->where('workflow_id', $workflow instanceof Workflow ? $workflow->getKey() : $workflow);
6768
}
6869
}

0 commit comments

Comments
 (0)