/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $chungloai = Chung_loai::get(); $hang = Hang::get(); $input = array_except(Input::all(), '_method'); $validation = Validator::make($input, Loai::$rules); if ($validation->passes()) { $loai = $this->loai->find($id); //lay thong tin cu $oldinfo = Loai::where('id', '=', $loai->id)->get()->toArray(); Logfileadmin::addData("Sửa", "Loại", $loai->id, Input::get('tenloai'), $oldinfo); $loai->update($input); return Redirect::route('loais.show', $id); } return Redirect::route('loais.edit', $id)->withInput()->withErrors($validation)->with('message', 'There were validation errors.')->with('chungloai', $chungloai)->with('hang', $hang); }