code = $code; $this->model = $model; $this->userConfirmationService = $userConfirmationService; $this->tokenQuery = $tokenQuery; } public function run() { $token = $this->tokenQuery ->whereUserId($this->model->id) ->whereCode($this->code) ->whereIsConfirmationType() ->one(); if ($token instanceof Token && !$token->getIsExpired()) { $token->delete(); return $this->userConfirmationService->run(); } return false; } }