public function book_cate($id) { $book_cate = Book_cate::findOrFail($id); $book_book_cates = $book_cate->book_book_cates()->paginate(6); $book_book_cates->setPath('/book_cate/' . $id); $data = array('book_book_cates' => $book_book_cates, 'category' => $book_cate->category->name, 'book_cate_name' => $book_cate->name); return Controller::myView('book._show_by_cate', $data); }
public function updateBookCate(UpdateBookCateCheck $request) { if (Auth::user()->role !== 1) { return redirect('/'); } $category = Book_cate::find((int) $request->input('categories')); $category->name = $request->input('book_cate'); $category->save(); return redirect('/admin/categories'); }