Completed
Push — master ( 2ccb51...4b9a6b )
by ARCANEDEV
02:56
created

PostsRoutes   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 98.08%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
c 3
b 0
f 0
lcom 1
cbo 1
dl 0
loc 77
ccs 51
cts 52
cp 0.9808
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 65 1
1
<?php namespace Arcanesoft\Blog\Http\Routes\Foundation;
2
3
use Arcanedev\Support\Bases\RouteRegister;
4
use Arcanesoft\Blog\Models\Post;
5
use Illuminate\Contracts\Routing\Registrar;
6
7
/**
8
 * Class     PostsRoutes
9
 *
10
 * @package  Arcanesoft\Blog\Http\Routes\Foundation
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class PostsRoutes extends RouteRegister
14
{
15
    /* ------------------------------------------------------------------------------------------------
16
     |  Main Functions
17
     | ------------------------------------------------------------------------------------------------
18
     */
19
    /**
20
     * Map routes.
21
     *
22
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
23
     */
24 8
    public function map(Registrar $router)
25
    {
26 8
        $this->group([
27 8
            'prefix'    => 'posts',
28 6
            'as'        => 'posts.',
29
        ], function () {
30 8
            $this->get('/', [
31 8
                'as'   => 'index',         // blog::foundation.posts.index
32 6
                'uses' => 'PostsController@index',
33 6
            ]);
34
35 8
            $this->get('trashed', [
36 8
                'as'   => 'trash',         // blog::foundation.posts.trash
37 6
                'uses' => 'PostsController@trash',
38 6
            ]);
39
40 8
            $this->get('create', [
41 8
                'as'   => 'create',        // blog::foundation.posts.create
42 6
                'uses' => 'PostsController@create',
43 6
            ]);
44
45 8
            $this->post('store', [
46 8
                'as'   => 'store',         // blog::foundation.posts.store
47 6
                'uses' => 'PostsController@store',
48 6
            ]);
49
50 8
            $this->group([
51 8
                'prefix' => '{blog_post_id}',
52
            ], function () {
53 8
                $this->get('show', [
54 8
                    'as'   => 'show',      // blog::foundation.posts.show
55 6
                    'uses' => 'PostsController@show',
56 6
                ]);
57
58 8
                $this->get('edit', [
59 8
                    'as'   => 'edit',      // blog::foundation.posts.edit
60 6
                    'uses' => 'PostsController@edit',
61 6
                ]);
62
63 8
                $this->put('update', [
64 8
                    'as'   => 'update',    // blog::foundation.posts.update
65 6
                    'uses' => 'PostsController@update',
66 6
                ]);
67
68 8
                $this->put('publish', [
69 8
                    'as'   => 'publish',   // blog::foundation.posts.activate
70 6
                    'uses' => 'PostsController@publish',
71 6
                ]);
72
73 8
                $this->put('restore', [
74 8
                    'as'   => 'restore',   // blog::foundation.posts.restore
75 6
                    'uses' => 'PostsController@restore',
76 6
                ]);
77
78 8
                $this->delete('delete', [
79 8
                    'as'   => 'delete',    // blog::foundation.posts.delete
80 6
                    'uses' => 'PostsController@delete',
81 6
                ]);
82 8
            });
83 8
        });
84
85 8
        $this->bind('blog_post_id', function($postId) {
0 ignored issues
show
Bug introduced by
The method bind() does not seem to exist on object<Arcanesoft\Blog\H...Foundation\PostsRoutes>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
86
            return Post::findOrFail($postId);
87 8
        });
88 8
    }
89
}
90