public function run() { $currentStage = $this->getCurrentStage(); if ($currentStage) { View::share('currentStage', $currentStage); } if (Input::ajax()) { //Is ajax if (Input::get('action') == 'saveStepData') { $stepIndex = Input::get('step', false); $data = Input::get('data', array()); if ($stepIndex === false) { //Step index not passed throw new InstallerException("Step id not passed"); } $step = $currentStage->getStepAtIndex($stepIndex); $prevStep = $currentStage->getStepAtIndex($stepIndex - 1); $step->setData($data); $step->run($prevStep); $currentStage->storeStepData($step); return; } } if ($currentStage) { View::share('currentStageContent', $currentStage->run()); $this->storeStageData($currentStage); } else { return "Invalid stage"; } View::share('stages', $this->getStages()); return View::make(INSTALLER_NAMESPACE . '::installer'); }