/** * Store the mapping the user has made. This is * * STEP SIX * * @return \Illuminate\Http\RedirectResponse */ public function saveMapping() { /* * Make sure all fields we need are accounted for. */ $fields = ['csv-file', 'csv-date-format', 'csv-has-headers', 'csv-map', 'csv-roles']; if (!$this->wizard->sessionHasValues($fields)) { Session::flash('warning', 'Could not recover upload.'); return redirect(route('csv.index')); } // save mapping to session. $mapped = []; if (!is_array(Input::get('mapping'))) { Session::flash('warning', 'Invalid mapping.'); return redirect(route('csv.map')); } foreach (Input::get('mapping') as $index => $data) { $mapped[$index] = []; foreach ($data as $value => $mapping) { if (intval($mapping) !== 0) { $mapped[$index][$value] = $mapping; } } } Session::put('csv-mapped', $mapped); // proceed to process. return redirect(route('csv.download-config-page')); }