public function postCreateGov() { $rules = array('name' => 'required|unique:gov,name', 'ministry' => 'required', 'where' => 'required', 'contact' => 'required', 'link' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::to('/admin/gov/create')->withErrors($validator)->withInput(Input::all()); } else { $gov = new Gov(); $gov->name = Input::get('name'); $gov->ministry = Input::get('ministry'); $gov->where = Input::get('where'); $gov->contact = Input::get('contact'); $gov->link = Input::get('link'); $gov->frequency = 0; $gov->save(); Session::flash('message', "สร้าง " . Input::get('name') . " สำเร็จ!!"); return Redirect::to('/admin/gov/create'); } }