CategoriesRoutes   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 96.55%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 56
ccs 28
cts 29
cp 0.9655
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindings() 0 6 1
B map() 0 35 1
1
<?php namespace Arcanesoft\Blog\Http\Routes\Admin;
2
3
use Arcanedev\Support\Routing\RouteRegistrar;
4
use Arcanesoft\Blog\Models\Category;
5
6
/**
7
 * Class     CategoriesRoutes
8
 *
9
 * @package  Arcanesoft\Blog\Http\Routes\Admin
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class CategoriesRoutes extends RouteRegistrar
13
{
14
    /* -----------------------------------------------------------------
15
     |  Main Methods
16
     | -----------------------------------------------------------------
17
     */
18
19
    /**
20
     * Route bindings.
21
     */
22
    public static function bindings()
23
    {
24 102
        (new static)->bind('blog_category', function ($id) {
25
            return Category::query()->withTrashed()->findOrFail($id);
26 102
        });
27 102
    }
28
29
    /**
30
     * Map routes.
31
     */
32
    public function map()
33
    {
34 102
        $this->prefix('categories')->name('categories.')->group(function () {
35 102
            $this->get('/', 'CategoriesController@index')
36 102
                 ->name('index');       // admin::blog.categories.index
37
38 102
            $this->get('trash', 'CategoriesController@trash')
39 102
                 ->name('trash');       // admin::blog.categories.trash
40
41 102
            $this->get('create', 'CategoriesController@create')
42 102
                 ->name('create');      // admin::blog.categories.create
43
44 102
            $this->post('store', 'CategoriesController@store')
45 102
                 ->name('store');       // admin::blog.categories.store
46
47 102
            $this->prefix('{blog_category}')->group(function () {
48 102
                $this->get('/', 'CategoriesController@show')
49 102
                     ->name('show');    // admin::blog.categories.show
50
51 102
                $this->get('edit', 'CategoriesController@edit')
52 102
                    ->name('edit');     // admin::blog.categories.edit
53
54 102
                $this->put('update', 'CategoriesController@update')
55 102
                     ->name('update');  // admin::blog.categories.update
56
57 102
                $this->put('restore', 'CategoriesController@restore')
58 102
                     ->middleware('ajax')
59 102
                     ->name('restore'); // admin::blog.categories.restore
60
61 102
                $this->delete('delete', 'CategoriesController@delete')
62 102
                     ->middleware('ajax')
63 102
                     ->name('delete'); // admin::blog.categories.delete
64 102
            });
65 102
        });
66 102
    }
67
}
68