Completed
Push — master ( 4d5a46...0c8810 )
by ARCANEDEV
09:08
created

PostsController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 27
ccs 0
cts 15
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 6 1
A show() 0 6 1
A archive() 0 6 1
1
<?php namespace Arcanesoft\Blog\Http\Controllers\Front;
2
3
use Arcanesoft\Blog\Models\Post;
4
5
/**
6
 * Class     PostsController
7
 *
8
 * @package  Arcanesoft\Blog\Http\Controllers\Front
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class PostsController extends Controller
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    public function index()
18
    {
19
        $posts = Post::published()->latest()->paginate(6);
20
21
        return $this->view('blog::front.posts.index', compact('posts'));
22
    }
23
24
    public function show($slug)
25
    {
26
        $post = Post::published()->where('slug', $slug)->firstOrFail();
27
28
        return $this->view('blog::front.posts.single', compact('post'));
29
    }
30
31
    public function archive($year)
32
    {
33
        $posts = Post::publishedAt($year)->latest()->paginate(6);
34
35
        return $this->view('blog::front.posts.single', compact('posts'));
36
    }
37
}
38