|
|
@@ -9,6 +9,8 @@ use Symfony\Component\HttpFoundation\Response;
|
|
|
|
|
|
if (! function_exists('admin_setting')) {
|
|
|
/**
|
|
|
+ * 获取或保存配置参数.
|
|
|
+ *
|
|
|
* @param string|array $key
|
|
|
* @param mixed $default
|
|
|
*
|
|
|
@@ -32,6 +34,8 @@ if (! function_exists('admin_setting')) {
|
|
|
|
|
|
if (! function_exists('admin_setting_array')) {
|
|
|
/**
|
|
|
+ * 获取配置参数并转化为数组格式.
|
|
|
+ *
|
|
|
* @param string $key
|
|
|
* @param mixed $default
|
|
|
*
|
|
|
@@ -45,6 +49,8 @@ if (! function_exists('admin_setting_array')) {
|
|
|
|
|
|
if (! function_exists('admin_extension_setting')) {
|
|
|
/**
|
|
|
+ * 获取扩展配置参数.
|
|
|
+ *
|
|
|
* @param string $extension
|
|
|
* @param string|array $key
|
|
|
* @param mixed $default
|
|
|
@@ -269,28 +275,11 @@ if (! function_exists('admin_controller_name')) {
|
|
|
*/
|
|
|
function admin_controller_name()
|
|
|
{
|
|
|
- static $name = [];
|
|
|
-
|
|
|
- $router = app('router');
|
|
|
-
|
|
|
- if (! $router->current()) {
|
|
|
- return 'undefined';
|
|
|
- }
|
|
|
-
|
|
|
- $actionName = $router->current()->getActionName();
|
|
|
-
|
|
|
- if (! isset($name[$actionName])) {
|
|
|
- $controller = class_basename(explode('@', $actionName)[0]);
|
|
|
-
|
|
|
- $name[$actionName] = str_replace('Controller', '', $controller);
|
|
|
- }
|
|
|
-
|
|
|
- return $name[$actionName];
|
|
|
+ return Helper::getControllerName();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (! function_exists('admin_path')) {
|
|
|
-
|
|
|
/**
|
|
|
* Get admin path.
|
|
|
*
|
|
|
@@ -367,7 +356,6 @@ if (! function_exists('admin_toastr')) {
|
|
|
}
|
|
|
|
|
|
if (! function_exists('admin_success')) {
|
|
|
-
|
|
|
/**
|
|
|
* Flash a success message bag to session.
|
|
|
*
|
|
|
@@ -381,7 +369,6 @@ if (! function_exists('admin_success')) {
|
|
|
}
|
|
|
|
|
|
if (! function_exists('admin_error')) {
|
|
|
-
|
|
|
/**
|
|
|
* Flash a error message bag to session.
|
|
|
*
|
|
|
@@ -395,7 +382,6 @@ if (! function_exists('admin_error')) {
|
|
|
}
|
|
|
|
|
|
if (! function_exists('admin_warning')) {
|
|
|
-
|
|
|
/**
|
|
|
* Flash a warning message bag to session.
|
|
|
*
|
|
|
@@ -409,7 +395,6 @@ if (! function_exists('admin_warning')) {
|
|
|
}
|
|
|
|
|
|
if (! function_exists('admin_info')) {
|
|
|
-
|
|
|
/**
|
|
|
* Flash a message bag to session.
|
|
|
*
|
|
|
@@ -589,6 +574,20 @@ if (! function_exists('admin_require_assets')) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+if (! function_exists('admin_javascript')) {
|
|
|
+ /**
|
|
|
+ * 暂存JS代码,并使用唯一字符串代替.
|
|
|
+ *
|
|
|
+ * @param string $scripts
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ function admin_javascript(string $scripts)
|
|
|
+ {
|
|
|
+ return Dcat\Admin\Support\JavaScript::make($scripts);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
if (! function_exists('admin_javascript_json')) {
|
|
|
/**
|
|
|
* @param array|object $data
|
|
|
@@ -603,7 +602,7 @@ if (! function_exists('admin_javascript_json')) {
|
|
|
|
|
|
if (! function_exists('admin_exit')) {
|
|
|
/**
|
|
|
- * 响应并中断后续逻辑.
|
|
|
+ * 响应数据并中断后续逻辑.
|
|
|
*
|
|
|
* @param Response|string|array $response
|
|
|
*
|