public function postChungloaisp() { if (Chung_loai::where('tenchungloai', '=', Input::get('tenchungloai'))->count() > 0) { return "false"; } else { return "true"; } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $input = array_except(Input::all(), '_method'); $validation = Validator::make($input, Chung_loai::$rules); if ($validation->passes()) { $chung_loai = $this->chung_loai->find($id); //lay thong tin cu $oldinfo = Chung_loai::where('id', '=', $chung_loai->id)->get()->toArray(); Logfileadmin::addData("Sửa", "Chủng Loại", $chung_loai->id, Input::get('tenchungloai'), $oldinfo); $chung_loai->update($input); return Redirect::route('chung_loais.show', $id)->with('oldinfo', $oldinfo); } return Redirect::route('chung_loais.edit', $id)->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }