public function postDistricts(Request $request, $nationality_id, $state_id, $lga_id) { $rules = array('title' => 'required'); $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return Redirect::to('/place/' . $nationality_id . '/' . $state_id . '/' . $lga_id)->withErrors($validator)->withInput($request->except('password')); } else { $user = new User(); $user->id = 1; //$user = Auth::user(); $record = new District(); $record->title = $request->get('title'); $record->lga()->associate(Lga::find($lga_id)); $record->state()->associate(State::find($state_id)); $record->nationality()->associate(Nationality::find($nationality_id)); $record->user()->associate($user); $record->save(); // redirect Session::flash('message', 'Successfully updated!'); return Redirect::to('/place/' . $nationality_id . '/' . $state_id . '/' . $lga_id); } }