1
|
|
|
<?php namespace Arcanesoft\Foundation\Bases; |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Class FoundationController |
5
|
|
|
* |
6
|
|
|
* @package Arcanesoft\Foundation\Bases |
7
|
|
|
* @author ARCANEDEV <[email protected]> |
8
|
|
|
*/ |
9
|
|
|
class FoundationController 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->setTemplate(config('arcanesoft.foundation.template')); |
34
|
|
|
$this->registerBreadcrumbs('foundation'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/* ------------------------------------------------------------------------------------------------ |
38
|
|
|
| Breadcrumbs Functions |
39
|
|
|
| ------------------------------------------------------------------------------------------------ |
40
|
|
|
*/ |
41
|
|
|
/** |
42
|
|
|
* Get the breadcrumbs home item (root). |
43
|
|
|
* |
44
|
|
|
* @return array |
45
|
|
|
*/ |
46
|
|
|
protected function getBreadcrumbsHomeItem() |
47
|
|
|
{ |
48
|
|
|
return [ |
49
|
|
|
'title' => 'Home', |
50
|
|
|
'url' => route('foundation::home') |
51
|
|
|
]; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/* ------------------------------------------------------------------------------------------------ |
55
|
|
|
| Views Functions |
56
|
|
|
| ------------------------------------------------------------------------------------------------ |
57
|
|
|
*/ |
58
|
|
|
/** |
59
|
|
|
* Display the view. |
60
|
|
|
* |
61
|
|
|
* @param string $name |
62
|
|
|
* @param array $data |
63
|
|
|
* |
64
|
|
|
* @return \Illuminate\View\View |
65
|
|
|
*/ |
66
|
|
|
protected function view($name, array $data = []) |
67
|
|
|
{ |
68
|
|
|
if ( ! is_null($this->viewNamespace)) { |
69
|
|
|
$name = "{$this->viewNamespace}::$name"; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
return parent::view($name, $data); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Do random stuff before rendering view. |
77
|
|
|
*/ |
78
|
|
|
protected function beforeViewRender() |
79
|
|
|
{ |
80
|
|
|
$this->loadBreadcrumbs(); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|