/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // Find the Range $range = Range::find($id); // Update data $range->label = $request->label; $range->notes = $request->notes; // Save it $range->save(); session()->flash('message', 'Range has been saved'); session()->flash('message-type', 'success'); return redirect()->action('RangeController@index'); }
public function show($cat, $group, $range) { $catId = Cat::where('slug', '=', $cat)->first(); $groupId = Group::where('slug', '=', $group)->first(); $rangeId = Range::where('slug', '=', $range)->first(); $cat_id = "%"; $catSlug = '0'; $catName = ''; if ($cat !== '0') { $cat_id = $catId->id; $catSlug = $catId->slug; $catName = $catId->name; } $group_id = "%"; $groupSlug = '0'; $groupName = ''; if ($group !== '0') { $group_id = $groupId->id; $groupSlug = $groupId->slug; $groupName = $groupId->name; } $range_id = "%"; $rangeSlug = '0'; $rangeName = ''; if ($range !== '0') { $range_id = $rangeId->id; $rangeSlug = $rangeId->slug; $rangeName = $rangeId->name; } // return $range_id; // $results = Product::with('range', 'group')->where('cat_id', 'LIKE', $cat_id, 'AND')->where('group_id', 'LIKE', $group_id, 'AND')->where('range_id', 'LIKE', $range_id)->orderby('order')->paginate(12); // return $cat_id . '-' . $group_id . '-' .$range_id ; $groups = Group::where('cat_id', 'LIKE', $cat_id)->get(); $ranges = Range::where('cat_id', 'LIKE', $cat_id)->orderby('order')->get(); $keywords = $catName . ', ' . $groupName . ', ' . $rangeName; Session::flash('keywords', $keywords); Session::flash('title', $catName); //return $results; return View::make('results', compact('results', 'groups', 'groupSlug', 'ranges', 'rangeSlug', 'cat_id', 'cat', 'catSlug', 'catName', 'groupName', 'rangeName')); //return View::make('results'); }