Skip to content

Commit

Permalink
Cleanup InteractsWithWorkflow trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschucki committed Oct 7, 2024
1 parent 267004e commit 3965831
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Concerns/InteractsWithWorkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@

namespace Tschucki\FilamentWorkflows\Concerns;

use Illuminate\Database\Eloquent\Relations\MorphMany;
use Tschucki\FilamentWorkflows\Support\Utils;

trait InteractsWithWorkflow
{
public function workflowLogs(): \Illuminate\Database\Eloquent\Relations\MorphMany
public function workflowLogs(): MorphMany
{
return $this->morphMany(Utils::getWorkflowLogModel(), 'model');
}

protected function workflows(): \Illuminate\Database\Eloquent\Relations\MorphMany
protected function workflows(): MorphMany
{
return $this->morphMany(Utils::getWorkflowModel(), 'model');
}

public function getWorkflows()
{
$model = Utils::getWorkflowModel();

if ($this->model_id === null) {
return (new $model)::where('model_id', null)->where('model_type', self::class)->get();
}
Expand Down

0 comments on commit 3965831

Please sign in to comment.