forked from jcc/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArticleController.php
44 lines (35 loc) · 1000 Bytes
/
ArticleController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use Illuminate\Http\Request;
use App\Repositories\ArticleRepository;
class ArticleController extends Controller
{
protected $article;
public function __construct(ArticleRepository $article)
{
$this->article = $article;
}
/**
* Display the articles resource.
*
* @return mixed
*/
public function index()
{
$articles = $this->article->page(config('blog.article.number'), config('blog.article.sort'), config('blog.article.sortColumn'));
return view('article.index', compact('articles'));
}
/**
* Display the article resource by article slug.
*
* @param string $slug
* @return mixed
*/
public function show($slug)
{
$article = $this->article->getBySlug($slug);
// $article->content = collect(json_decode($article->content))->get('html');
return view('article.show', compact('article'));
}
}