Completed
Push — master ( 9c542a...5db7ed )
by ARCANEDEV
13s
created

CategoriesRoutes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 96.3%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 56
ccs 26
cts 27
cp 0.963
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 62
        (new static)->bind('blog_category', function ($id) {
25
            return Category::query()->withTrashed()->findOrFail($id);
26 62
        });
27 62
    }
28
29
    /**
30
     * Map routes.
31
     */
32
    public function map()
33
    {
34 62
        $this->prefix('categories')->name('categories.')->group(function () {
35 62
            $this->get('/', 'CategoriesController@index')
36 62
                 ->name('index');       // admin::blog.categories.index
37
38 62
            $this->get('trash', 'CategoriesController@trash')
39 62
                 ->name('trash');       // admin::blog.categories.trash
40
41 62
            $this->get('create', 'CategoriesController@create')
42 62
                 ->name('create');      // admin::blog.categories.create
43
44 62
            $this->post('store', 'CategoriesController@store')
45 62
                 ->name('store');       // admin::blog.categories.store
46
47 62
            $this->prefix('{blog_category}')->group(function () {
48 62
                $this->get('/', 'CategoriesController@show')
49 62
                     ->name('show');    // admin::blog.categories.show
50
51 62
                $this->get('edit', 'CategoriesController@edit')
52 62
                    ->name('edit');     // admin::blog.categories.edit
53
54 62
                $this->put('update', 'CategoriesController@update')
55 62
                     ->name('update');  // admin::blog.categories.update
56
57 62
                $this->put('restore', 'CategoriesController@restore')
58 62
                     ->middleware('ajax')
59 62
                     ->name('restore'); // admin::blog.categories.restore
60
61 62
                $this->delete('delete', 'CategoriesController@delete')
62 62
                     ->middleware('ajax')
63 62
                     ->name('delete'); // admin::blog.categories.delete
64 62
            });
65
        });
66
    }
67
}
68