예제 #1
0
 public function sort(Request $request, $id)
 {
     Cache::forget('cats');
     $data = $request->input('sort');
     Cat::findOrFail($id)->update(['sort' => $data]);
     return trans('sections.sort_section') . ' #' . $id . ' ' . trans('sections.sort_changed') . ' ' . $data . ' ' . trans('sections.sort_position');
 }
예제 #2
0
 /**
  * Cat edit.
  *
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // Log::info('Showing user profile for user: '.$id);
     return response()->json(Cat::findOrFail($id));
 }
예제 #3
0
 public function bizCat($id)
 {
     $cat = Cat::findOrFail($id);
     $bizs = $cat->biz;
     $cats = Cat::all();
     $stateList = State::lists('name', 'name');
     $catList = Cat::lists('name', 'name');
     $featured = Biz::whereFeatured('YES')->paginate(3);
     $recent = Biz::orderBy('created_at', 'desc')->paginate(1);
     return view('pages.biz-cat', compact('bizs', 'stateList', 'catList', 'cats', 'featured', 'recent', 'cat'));
 }
예제 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $cat = Cat::findOrFail($id);
     $cat->delete();
     return redirect('/admin/cat')->withSuccess("The '{$cat->name}' category has been deleted.");
 }
 /**
  * Update the cat in the database.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CatRequest $request, $id)
 {
     $cat = Cat::findOrFail($id);
     $cat->update($request->only(['name', 'age']));
     return $cat;
 }