Completed
Push — master ( 677d17...3a2fd6 )
by ARCANEDEV
04:32
created

PostsRoutes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 96.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 59
ccs 29
cts 30
cp 0.9667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindings() 0 8 1
B map() 0 36 1
1
<?php namespace Arcanesoft\Blog\Http\Routes\Admin;
2
3
use Arcanedev\Support\Routing\RouteRegistrar;
4
use Arcanesoft\Blog\Models\Post;
5
6
/**
7
 * Class     PostsRoutes
8
 *
9
 * @package  Arcanesoft\Blog\Http\Routes\Admin
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class PostsRoutes extends RouteRegistrar
13
{
14
    /* -----------------------------------------------------------------
15
     |  Main Functions
16
     | -----------------------------------------------------------------
17
     */
18
19
    /**
20
     * Route bindings.
21
     */
22 6
    public static function bindings()
23
    {
24 6
        $registrar = new static;
25
26
        $registrar->bind('blog_post', function($postId) {
27
            return Post::withTrashed()->findOrFail($postId);
0 ignored issues
show
Bug introduced by
The method withTrashed() does not exist on Arcanesoft\Blog\Models\Post. Did you maybe mean trashed()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
28 6
        });
29 6
    }
30
31
    /**
32
     * Map routes.
33
     */
34 6
    public function map()
35
    {
36
        $this->prefix('posts')->name('posts.')->group(function () {
37 6
            $this->get('/', 'PostsController@index')
38 6
                 ->name('index');       // admin::blog.posts.index
39
40 6
            $this->get('trash', 'PostsController@trash')
41 6
                 ->name('trash');       // admin::blog.posts.trash
42
43 6
            $this->get('create', 'PostsController@create')
44 6
                 ->name('create');      // admin::blog.posts.create
45
46 6
            $this->post('store', 'PostsController@store')
47 6
                 ->name('store');       // admin::blog.posts.store
48
49 6
            $this->prefix('{blog_post}')->group(function () {
50 6
                $this->get('show', 'PostsController@show')
51 6
                     ->name('show');    // admin::blog.posts.show
52
53 6
                $this->get('edit', 'PostsController@edit')
54 6
                     ->name('edit');    // admin::blog.posts.edit
55
56 6
                $this->put('update', 'PostsController@update')
57 6
                     ->name('update');  // admin::blog.posts.update
58
59 6
                $this->put('publish', 'PostsController@publish')
60 6
                     ->name('publish'); // admin::blog.posts.activate
61
62 6
                $this->put('restore', 'PostsController@restore')
63 6
                     ->name('restore'); // admin::blog.posts.restore
64
65 6
                $this->delete('delete', 'PostsController@delete')
66 6
                     ->name('delete');  // admin::blog.posts.delete
67 6
            });
68 6
        });
69 6
    }
70
}
71