public function postConfiguration() { $tablename = Input::get('tablename'); $header = Input::get('header'); $csv = Session::get('csv'); $path = Session::get('csvpath'); // check if there is a table with the same name in the database if (!Schema::connection('dataset')->hasTable($tablename)) { // Save to database $this->saveToDB($path, $tablename, $header, $csv); // sending back with message Session::flash('success', 'Uploaded successfully'); } else { // sending back with message Session::flash('error', 'Dataset with the same name already exist in database'); } $dataset = \App\Dataset::where('table_name', $tablename)->first(); return Redirect::to('dataset/edit/' . $dataset->id); }