orderId = $orderId; $this->currentStep = $this->getCurrentStep(); $this->currentStep = $this->getCurrentStep(); } /** * @return string */ public function getOrderId(): string { return $this->orderId; } /** * @return string */ public function getCurrentStep(): string { return Order::findOrFail($this->getOrderId())->current_step; } /** * @param string $currentStep */ public function setCurrentStep(string $currentStep): void { $this->currentStep = $currentStep; } /** * @return null|string */ public function getNextStep(): ?string { $nextStep = OrderStep::where('order_id', $this->getOrderId()) ->where('complete', 0)->orderBy('sequence')->first(); return $nextStep ? $nextStep->reference_id : null; } /** * @param null|string $nextStep */ public function setNextStep(?string $nextStep): void { $this->nextStep = $nextStep; } }