/** * Edits a item * @param Items $item */ public function editItem($item) { // Validate the inputs $validator = Validator::make(Input::all(), $item->getUpdateRules()); if ($validator->passes()) { $oldItem = clone $item; $item->name = Input::get('name'); $item->description = Input::get('description'); $item->price = Input::get('price'); $item->city = Input::get('city'); $item->state = Input::get('state'); $item->street = Input::get('street'); $item->prepareRules($oldItem, $item); // Save if valid. Password field will be hashed before save $item->amend(); } // Get validation errors (see Ardent package) $error = $item->errors()->all(); if (empty($error)) { return Redirect::to('item')->with('success', Lang::get('item/item.item_updated')); } }