7
7
8
8
/**
9
9
* Get the path to a versioned file.
10
- *
11
- * @param string $file
12
- * @return string
13
10
* @throws Exception
14
11
*/
15
12
function versioned_asset (string $ file = '' ): string
@@ -33,7 +30,6 @@ function versioned_asset(string $file = ''): string
33
30
/**
34
31
* Helper method to get the current User.
35
32
* Defaults to public 'Guest' user if not logged in.
36
- * @return User
37
33
*/
38
34
function user (): User
39
35
{
@@ -57,9 +53,8 @@ function hasAppAccess(): bool
57
53
}
58
54
59
55
/**
60
- * Check if the current user has a permission.
61
- * If an ownable element is passed in the jointPermissions are checked against
62
- * that particular item.
56
+ * Check if the current user has a permission. If an ownable element
57
+ * is passed in the jointPermissions are checked against that particular item.
63
58
*/
64
59
function userCan (string $ permission , Ownable $ ownable = null ): bool
65
60
{
@@ -75,9 +70,6 @@ function userCan(string $permission, Ownable $ownable = null): bool
75
70
/**
76
71
* Check if the current user has the given permission
77
72
* on any item in the system.
78
- * @param string $permission
79
- * @param string|null $entityClass
80
- * @return bool
81
73
*/
82
74
function userCanOnAny (string $ permission , string $ entityClass = null ): bool
83
75
{
@@ -87,27 +79,26 @@ function userCanOnAny(string $permission, string $entityClass = null): bool
87
79
88
80
/**
89
81
* Helper to access system settings.
90
- * @param string $key
91
- * @param $default
92
82
* @return bool|string|SettingService
93
83
*/
94
84
function setting (string $ key = null , $ default = false )
95
85
{
96
86
$ settingService = resolve (SettingService::class);
87
+
97
88
if (is_null ($ key )) {
98
89
return $ settingService ;
99
90
}
91
+
100
92
return $ settingService ->get ($ key , $ default );
101
93
}
102
94
103
95
/**
104
96
* Get a path to a theme resource.
105
- * @param string $path
106
- * @return string
107
97
*/
108
98
function theme_path (string $ path = '' ): string
109
99
{
110
100
$ theme = config ('view.theme ' );
101
+
111
102
if (!$ theme ) {
112
103
return '' ;
113
104
}
@@ -121,9 +112,6 @@ function theme_path(string $path = ''): string
121
112
* to the 'resources/assets/icons' folder.
122
113
*
123
114
* Returns an empty string if icon file not found.
124
- * @param $name
125
- * @param array $attrs
126
- * @return mixed
127
115
*/
128
116
function icon (string $ name , array $ attrs = []): string
129
117
{
@@ -139,6 +127,7 @@ function icon(string $name, array $attrs = []): string
139
127
140
128
$ iconPath = resource_path ('icons/ ' . $ name . '.svg ' );
141
129
$ themeIconPath = theme_path ('icons/ ' . $ name . '.svg ' );
130
+
142
131
if ($ themeIconPath && file_exists ($ themeIconPath )) {
143
132
$ iconPath = $ themeIconPath ;
144
133
} else if (!file_exists ($ iconPath )) {
0 commit comments