public function save_shelf() { $id = Input::get('id'); $store_id = Input::get('store_id'); $department_id = Input::get('department_id'); $shelf = Shelf::find($id); if (!$shelf) { $shelf = new Shelf(); } $shelf->name = Input::get('name'); $shelf->store_id = $store_id; $shelf->department_id = $department_id; $shelf->save(); $message = "Successfully updated the shelf"; $type = "success"; return Redirect::to('/admin/store/' . $store_id . '/department/' . $department_id . '/shelves')->with('type', $type)->with('message', $message); }