(Update) Articles/News System

- general cleanup
- moved validation rules out of model and into controller
This commit is contained in:
HDVinnie
2018-05-18 14:20:43 -04:00
parent a5fa96f955
commit fe6ca8a17a
3 changed files with 38 additions and 33 deletions

View File

@@ -16,16 +16,13 @@ use App\Article;
class ArticleController extends Controller
{
/**
* Show Articles
*
* @access public
* @return post.articles
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function articles()
{
// Fetch posts by created_at DESC order
$articles = Article::latest()->paginate(6);
return view('article.articles', ['articles' => $articles]);
@@ -34,14 +31,11 @@ class ArticleController extends Controller
/**
* Show Article
*
* @access public
* @return post.post
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function post($slug, $id)
{
// Find de right post
$article = Article::findOrFail($id);
// Get comments on this post
$comments = $article->comments()->latest()->get();
return view('article.article', ['article' => $article, 'comments' => $comments]);