AdminController::initSeo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 5
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
     |  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