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

CategoriesRoutes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 96.43%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindings() 0 8 1
B map() 0 33 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 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_category', function ($id) {
27
            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...
28 6
        });
29 6
    }
30
31
    /**
32
     * Map routes.
33
     */
34 6
    public function map()
35
    {
36
        $this->prefix('categories')->name('categories.')->group(function () {
37 6
            $this->get('/', 'CategoriesController@index')
38 6
                 ->name('index');       // admin::blog.categories.index
39
40 6
            $this->get('trash', 'CategoriesController@trash')
41 6
                 ->name('trash');       // admin::blog.categories.trash
42
43 6
            $this->get('create', 'CategoriesController@create')
44 6
                 ->name('create');      // admin::blog.categories.create
45
46 6
            $this->post('store', 'CategoriesController@store')
47 6
                 ->name('store');       // admin::blog.categories.store
48
49 6
            $this->prefix('{blog_category}')->group(function () {
50 6
                $this->get('/', 'CategoriesController@show')
51 6
                     ->name('show');    // admin::blog.categories.show
52
53 6
                $this->get('edit', 'CategoriesController@edit')
54 6
                    ->name('edit');     // admin::blog.categories.edit
55
56 6
                $this->put('update', 'CategoriesController@update')
57 6
                     ->name('update');  // admin::blog.categories.update
58
59 6
                $this->put('restore', 'CategoriesController@restore')
60 6
                     ->name('restore'); // admin::blog.categories.restore
61
62 6
                $this->delete('delete', 'CategoriesController@delete')
63 6
                     ->name('delete'); // admin::blog.categories.delete
64 6
            });
65 6
        });
66 6
    }
67
}
68