/** * Parse the file. * * STEP FOUR * * @return \Illuminate\Http\RedirectResponse */ public function initialParse() { $fields = ['csv-file', 'csv-date-format', 'csv-has-headers']; if (!$this->wizard->sessionHasValues($fields)) { Session::flash('warning', 'Could not recover upload.'); return redirect(route('csv.index')); } // process given roles and mapping: $roles = $this->wizard->processSelectedRoles(Input::get('role')); $maps = $this->wizard->processSelectedMapping($roles, Input::get('map')); Session::put('csv-map', $maps); Session::put('csv-roles', $roles); // Go back when no roles defined: if (count($roles) === 0) { Session::flash('warning', 'Please select some roles.'); return redirect(route('csv.column-roles')); } /* * Continue with map specification when necessary. */ if (count($maps) > 0) { return redirect(route('csv.map')); } /* * Or simply start processing. */ // proceed to download config return redirect(route('csv.download-config-page')); }