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

CategoriesRoutes::map()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 37
ccs 24
cts 25
cp 0.96
rs 8.8571
cc 1
eloc 23
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\Category;
5
use Illuminate\Contracts\Routing\Registrar;
6
7
/**
8
 * Class     CategoriesRoutes
9
 *
10
 * @package  Arcanesoft\Blog\Http\Routes\Admin
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class CategoriesRoutes 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' => 'categories', 'as' => 'categories.'], function () {
27 6
            $this->get('/', 'CategoriesController@index')
28 6
                 ->name('index');       // admin::blog.categories.index
29
30 6
            $this->get('trash', 'CategoriesController@trash')
31 6
                 ->name('trash');       // admin::blog.categories.trash
32
33 6
            $this->get('create', 'CategoriesController@create')
34 6
                 ->name('create');      // admin::blog.categories.create
35
36 6
            $this->post('store', 'CategoriesController@store')
37 6
                 ->name('store');       // admin::blog.categories.store
38
39
            $this->group(['prefix' => '{blog_category}'], function () {
40 6
                $this->get('/', 'CategoriesController@show')
41 6
                     ->name('show');    // admin::blog.categories.show
42
43 6
                $this->get('edit', 'CategoriesController@edit')
44 6
                    ->name('edit');     // admin::blog.categories.edit
45
46 6
                $this->put('update', 'CategoriesController@update')
47 6
                     ->name('update');  // admin::blog.categories.update
48
49 6
                $this->put('restore', 'CategoriesController@restore')
50 6
                     ->name('restore'); // admin::blog.categories.restore
51
52 6
                $this->delete('delete', 'CategoriesController@delete')
53 6
                     ->name('delete'); // admin::blog.categories.delete
54 6
            });
55 6
        });
56
57 6
        $this->bind('blog_category', function ($id) {
58
            return Category::withTrashed()->findOrFail($id);
0 ignored issues
show
Bug introduced by
The method withTrashed() does not exist on Arcanesoft\Blog\Models\Category. 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...
59 6
        });
60 6
    }
61
}
62