/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $article = Article::find($id); $icons = Icon::all(); $tags = Tag::all(); return view('admin.contents.blog.article.edit')->with('article', $article)->with('icons', $icons)->with('tags', $tags); }
/** * 指定したTagをもつ記事の一覧表示 * * @return Response */ public function getTag($slug) { $name = Tag::where('slug', $slug)->first(); if (!$name) { return abort(404); } else { $title = $name->name; } $articles = Article::where('state', 'public')->whereHas('tags', function ($q) use($slug) { $q->where('slug', $slug); })->orderBy('created_at', 'desc')->with('icon')->get(); $count = $articles->count(); return view('contents.blog.tag.index')->with('articles', $articles)->with('count', $count)->with('title', $title); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(DestroyRequest $request, $id) { Tag::destroy($id); return redirect()->route('admin.blog.tag.index')->with('success', 'タグを削除しました。'); }