mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-01-23 04:21:16 -06:00
(Update) Articles/News System
- general cleanup - moved validation rules out of model and into controller
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user