/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Palette $palette, Color $color) { $input = array_except(Input::all(), '_method'); $validation = Validator::make($input, Color::$rules); if ($validation->passes()) { // $color = $this->color->find($id); $color->update($input); return Redirect::route($this->route . '.show', [$palette->id, $color->id]); } return Redirect::back()->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }
} if ($_POST['commit'] == "Save Color") { if ($id == 0) { // insert $obj = new Color(); $obj->CategoryId = $_REQUEST["cat"]; $obj->OverviewText = $_REQUEST["overview_text"]; $obj->create(); // redirect to listing list header("Location:color_list.php&cat=" . $_REQUEST['cat']); exit; } else { // update $obj = new Color($_REQUEST["id"]); $obj->OverviewText = $_REQUEST["overview_text"]; $obj->update(); // redirect to listing list header("Location:color_list.php&cat=" . $_REQUEST['cat']); exit; } } else { if ($_REQUEST['mode'] == 'e') { //listing $objColor = new Color($id); $overview_text = $objColor->OverviewText; } } include "includes/pagetemplate.php"; function PageContent() { global $id;