Completed
Push — master ( a033a0...27c653 )
by ARCANEDEV
03:28
created

AdminController::getBreadcrumbsHomeItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 7
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
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
     |  Properties
13
     | ------------------------------------------------------------------------------------------------
14
     */
15
    /**
16
     * The view namespace.
17
     *
18
     * @var string
19
     */
20
    protected $viewNamespace = 'foundation';
21
22
    /* ------------------------------------------------------------------------------------------------
23
     |  Constructor
24
     | ------------------------------------------------------------------------------------------------
25
     */
26
    /**
27
     * Instantiate the controller.
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
33
        $this->initSeo();
34
        $this->registerBreadcrumbs('foundation');
35
        $this->setTemplate(config('arcanesoft.foundation.template'));
36
    }
37
38
    /* ------------------------------------------------------------------------------------------------
39
     |  SEO Functions
40
     | ------------------------------------------------------------------------------------------------
41
     */
42
    /**
43
     * Init SEO.
44
     */
45
    private function initSeo()
46
    {
47
        $this->seo()->disableOpenGraph();
48
        $this->seo()->disableTwitter();
49
    }
50
51
    /* ------------------------------------------------------------------------------------------------
52
     |  Breadcrumbs Functions
53
     | ------------------------------------------------------------------------------------------------
54
     */
55
    /**
56
     * Get the breadcrumbs home item (root).
57
     *
58
     * @return array
59
     */
60
    protected function getBreadcrumbsHomeItem()
61
    {
62
        return [
63
            'title' => trans('core::generals.home'),
64
            'url'   => route('admin::foundation.home'),
65
        ];
66
    }
67
68
    /* ------------------------------------------------------------------------------------------------
69
     |  Views Functions
70
     | ------------------------------------------------------------------------------------------------
71
     */
72
    /**
73
     * Display the view.
74
     *
75
     * @param  string  $name
76
     * @param  array   $data
77
     *
78
     * @return \Illuminate\View\View
79
     */
80
    protected function view($name, array $data = [])
81
    {
82
        $name = is_null($this->viewNamespace) ? $name : "{$this->viewNamespace}::$name";
83
84
        return parent::view($name, $data);
85
    }
86
87
    /**
88
     * Do random stuff before rendering view.
89
     */
90
    protected function beforeViewRender()
91
    {
92
        $this->loadBreadcrumbs();
93
    }
94
}
95