/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($slug, Category $category) { $cid = $category->where('id', $slug)->first(); $id = $cid->id; /* get the atributes of the category model whose id == $id */ $category = $category->whereId($id)->first(); /* get the Edit page the selected category via id */ return view('themes.default1.agent.kb.category.edit', compact('category')); }
public function getCategory($slug, Article $article, Category $category, Relationship $relation) { /* get the article_id where category_id == current category */ $catid = $category->where('slug', $slug)->first(); $id = $catid->id; $all = $relation->where('category_id', $id)->get(); // $all->setPath(''); /* from whole attribute pick the article_id */ $article_id = $all->lists('article_id'); $categorys = $category->get(); /* direct to view with $article_id */ return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id')); }