|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
function dumpVar() |
|
4
|
|
|
{ |
|
5
|
|
|
array_map(function ($x) { |
|
6
|
|
|
(new \Illuminate\Support\Debug\Dumper())->dump($x); |
|
7
|
|
|
}, func_get_args()); |
|
8
|
|
|
} |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Return the auth account instance class. |
|
12
|
|
|
* |
|
13
|
|
|
* @return \App\Model\Account|\Illuminate\Contracts\Auth\Authenticatable |
|
14
|
|
|
*/ |
|
15
|
|
|
function account() |
|
16
|
|
|
{ |
|
17
|
|
|
return auth()->user(); |
|
|
|
|
|
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Get the path to the dashboard folder. |
|
22
|
|
|
* |
|
23
|
|
|
* @param string $path |
|
24
|
|
|
* @return string |
|
25
|
|
|
*/ |
|
26
|
|
|
function dashboard_path($path = '') |
|
|
|
|
|
|
27
|
|
|
{ |
|
28
|
|
|
return app()->make('path.dashboard').($path ? DIRECTORY_SEPARATOR.$path : $path); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Return the webshelf framework version. |
|
33
|
|
|
* |
|
34
|
|
|
* @return App\Framework |
|
35
|
|
|
*/ |
|
36
|
|
|
function framework() |
|
37
|
|
|
{ |
|
38
|
|
|
return app(App\Framework::class); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return \App\Classes\PopupQueue |
|
43
|
|
|
*/ |
|
44
|
|
|
function popups() |
|
45
|
|
|
{ |
|
46
|
|
|
return app(App\Classes\PopupQueue::class); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return \App\Classes\SettingsManager |
|
51
|
|
|
*/ |
|
52
|
|
|
function settings() |
|
53
|
|
|
{ |
|
54
|
|
|
return app(\App\Classes\SettingsManager::class); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return \App\Classes\PluginManager |
|
59
|
|
|
*/ |
|
60
|
|
|
function plugins() |
|
61
|
|
|
{ |
|
62
|
|
|
return app(\App\Classes\PluginManager::class); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
function makeSlug(\App\Model\Page $page) |
|
66
|
|
|
{ |
|
67
|
|
|
try { |
|
68
|
|
|
if ($page->menu) { |
|
69
|
|
|
if ($page->menu->parent) { |
|
70
|
|
|
return $page->menu->parent->slug.'/'.$page->slug; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
|
74
|
|
|
throw new \Exception('Unexpected error occurred for url creation of the page '.$page->slug); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
return $page->slug; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
function makeUrl(\App\Model\Page $page) |
|
81
|
|
|
{ |
|
82
|
|
|
return url(makeSlug($page)); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Turn a boolean value into readable data. |
|
87
|
|
|
* true = Active |
|
88
|
|
|
* false = Inactive. |
|
89
|
|
|
* |
|
90
|
|
|
* @param $boolean |
|
91
|
|
|
* @param null $trueMessage |
|
92
|
|
|
* @param null $falseMessage |
|
93
|
|
|
* @return string |
|
94
|
|
|
* @internal param null $true |
|
95
|
|
|
* @internal param null $false |
|
96
|
|
|
*/ |
|
97
|
|
|
function bool2Status($boolean, $trueMessage = null, $falseMessage = null) |
|
98
|
|
|
{ |
|
99
|
|
|
if ($boolean == true) { |
|
100
|
|
|
return '<span class="status green">'.($trueMessage ?: 'Active').'</span>'; |
|
101
|
|
|
} else { |
|
102
|
|
|
return '<span class="status red">'.($falseMessage ?: 'Inactive').'</span>'; |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
function currentURI() |
|
107
|
|
|
{ |
|
108
|
|
|
$route = basename(request()->path()) ?: 'index'; |
|
109
|
|
|
|
|
110
|
|
|
return $route != '' ? $route : 'index'; |
|
111
|
|
|
} |
|
112
|
|
|
|
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: