AdminController   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A initSeo() 0 5 1
A getBreadcrumbsHomeItem() 0 7 1
A view() 0 6 2
A beforeViewRender() 0 4 1
1
<?php namespace Arcanesoft\Core\Http\Controllers;
2
3
/**
4
 * Class     AdminController
5
 *
6
 * @package  Arcanesoft\Core\Bases
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
abstract class AdminController extends Controller
10
{
11
    /* -----------------------------------------------------------------
12
     |  Constructor
13
     | -----------------------------------------------------------------
14
     */
15
16
    /**
17
     * Instantiate the controller.
18
     */
19
    public function __construct()
20
    {
21
        parent::__construct();
22
23
        $this->initSeo();
24
        $this->registerBreadcrumbs('foundation');
25
        $this->setTemplate(config('arcanesoft.foundation.template'));
26
    }
27
28
    /* -----------------------------------------------------------------
29
     |  SEO Methods
30
     | -----------------------------------------------------------------
31
     */
32
33
    /**
34
     * Init SEO.
35
     */
36
    private function initSeo()
37
    {
38
        $this->seo()->disableOpenGraph();
39
        $this->seo()->disableTwitter();
40
    }
41
42
    /* -----------------------------------------------------------------
43
     |  Breadcrumbs Methods
44
     | -----------------------------------------------------------------
45
     */
46
47
    /**
48
     * Get the breadcrumbs home item (root).
49
     *
50
     * @return array
51
     */
52
    protected function getBreadcrumbsHomeItem()
53
    {
54
        return [
55
            'title' => trans('core::generals.home'),
56
            'url'   => route('admin::foundation.home'),
57
        ];
58
    }
59
60
    /* -----------------------------------------------------------------
61
     |  Views Methods
62
     | -----------------------------------------------------------------
63
     */
64
65
    /**
66
     * Display the view.
67
     *
68
     * @param  string  $name
69
     * @param  array   $data
70
     *
71
     * @return \Illuminate\View\View
72
     */
73
    protected function view($name, array $data = [])
74
    {
75
        $name = is_null($this->viewNamespace) ? $name : "{$this->viewNamespace}::$name";
76
77
        return parent::view($name, $data);
78
    }
79
80
    /**
81
     * Do random stuff before rendering view.
82
     */
83
    protected function beforeViewRender()
84
    {
85
        $this->loadBreadcrumbs();
86
    }
87
}
88