Completed
Pull Request — master (#3)
by ARCANEDEV
03:48 queued 01:31
created

PostsRoutes::map()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 40
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 26
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 40
ccs 26
cts 27
cp 0.963
rs 8.8571
cc 1
eloc 25
nc 1
nop 1
crap 1
1
<?php namespace Arcanesoft\Blog\Http\Routes\Admin;
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\Admin
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 6
    public function map(Registrar $router)
25
    {
26
        $this->group(['prefix' => 'posts', 'as' => 'posts.'], function () {
27 6
            $this->get('/', 'PostsController@index')
28 6
                 ->name('index');       // admin::blog.posts.index
29
30 6
            $this->get('trash', 'PostsController@trash')
31 6
                ->name('trash');        // admin::blog.posts.trash
32
33 6
            $this->get('create', 'PostsController@create')
34 6
                 ->name('create');      // admin::blog.posts.create
35
36 6
            $this->post('store', 'PostsController@store')
37 6
                 ->name('store');       // admin::blog.posts.store
38
39
            $this->group(['prefix' => '{blog_post}'], function () {
40 6
                $this->get('show', 'PostsController@show')
41 6
                     ->name('show');    // admin::blog.posts.show
42
43 6
                $this->get('edit', 'PostsController@edit')
44 6
                     ->name('edit');    // admin::blog.posts.edit
45
46 6
                $this->put('update', 'PostsController@update')
47 6
                     ->name('update');  // admin::blog.posts.update
48
49 6
                $this->put('publish', 'PostsController@publish')
50 6
                     ->name('publish'); // admin::blog.posts.activate
51
52 6
                $this->put('restore', 'PostsController@restore')
53 6
                     ->name('restore'); // admin::blog.posts.restore
54
55 6
                $this->delete('delete', 'PostsController@delete')
56 6
                     ->name('delete');  // admin::blog.posts.delete
57 6
            });
58 6
        });
59
60 6
        $this->bind('blog_post', function($postId) {
61
            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...
62 6
        });
63 6
    }
64
}
65