published()->get(); return view('articles.index', compact('articles')); } /** * Show the form for creating a new resource. * * @return Response */ public function create() { return view('articles.create'); } /** * Store a newly created resource in storage. * * @return Response */ public function store(ArticleRequest $request) { Article::create($request->all()); return redirect('articles'); } /** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $article = Article::findOrfail($id); return view('articles.show', compact('article')); } /** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $article = Article::findOrfail($id); return view('articles.edit', compact('article')); } /** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, ArticleRequest $request) { $article = Article::findOrfail($id); $article->update($request->all()); return redirect('articles'); } /** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $article = Article::findOrfail($id); $article->delete(); return redirect('articles'); } }