where('from_step_id', $where['from_step_id']); } if (($where['to_step_id'] ?? '') !== '') { $query->where('to_step_id', $where['to_step_id']); } if (($where['relation_type'] ?? '') !== '') { $query->where('relation_type', $where['relation_type']); } return $query; } public function getPreviousSteps(int|string $currentStepId): array { return $this->getModel()::query() ->where('to_step_id', $currentStepId) ->where('status', 1) ->orderBy('priority', 'asc') ->orderBy('sort', 'asc') ->get(['id', 'from_step_id', 'to_step_id', 'relation_type']) ->toArray(); } }