doctype_admin/settings

Doctype Admin Panel Settings 插件

v1.0.4 2020-10-08 09:38 UTC

This package is auto-updated.

Last update: 2024-09-08 18:36:11 UTC


README

Doctype Admin Setting Issues Stars Downloads

Laravel 7 Admin Panel Settings 插件,专为懒惰的开发者设计。

包含:

  • 设置管理系统

安装

运行 Composer Require 命令

composer require doctype_admin/settings

然后迁移数据库

php artisan migrate

要使用特定的种子,请先发布它们

php artisan db:seed --class=SettingsTableSeeder

如果您想修改内容,请...

安装包资源

安装所有资源

php artisan DoctypeAdminSetting:install -a

此命令将发布

  • 名为 Setting.php 的配置文件
  • 设置视图文件
  • 迁移文件
  • 种子文件

仅安装配置文件

php artisan DoctypeAdminSetting:install -c

仅安装视图文件

php artisan DoctypeAdminSetting:install -f

仅安装迁移文件

php artisan DoctypeAdminSetting:install -m

仅安装种子文件

php artisan DoctypeAdminSetting:install -d

注意

如果找不到种子类,请尝试运行 composer dump-autoload

要将包路由链接添加到侧边菜单以便访问,只需在 config/adminlte.php 下的 'menu' 键中添加以下内容

        [
            'text' => 'Setting',
            'icon' => 'fas fa-cog',
            'url' => 'admin/setting'
        ],

设置插件包含以下输入字段

  • 文本字段
  • 富文本区域
  • 图片
  • 选择
  • 单选按钮
  • 复选框

如何访问设置值?

我们可以通过简单地使用 blade 指令来全局访问设置分配的值

{{@setting('setting_name')}} // setting_name is one you make while you are creating setting (should be lower cap with space replaced by underscore(_) : Recommended)

例如

如果我们有一个设置,并且您将其命名为 "网站名称",那么要使用分配给该设置的值,请使用

{{@setting('site_name')}}

自定义

它使用 JSON 对象来自定义输入字段。

自定义对象

示例

简单文本字段设置自定义

{
  "class" : "my_class",
  "id" : "my_id",
  "value" : "Doctype Admin",
  "placeholder" : "Site Title Here!!",
  "style" : {
    "color" : "red"
  }
}

简单富文本区域设置自定义

{
  "class" : "my_class",
  "id" : "another_id",
  "placeholder" : "Rich Text Placeholder",
  "style" : {
    "color" : "red"
  }

简单选择字段设置自定义

{
  "default" : "1",
  "options" : {
    "1" : "option 1",
    "2" : "option 2"
  }
}

简单单选按钮字段设置自定义 注意类型对象是必需的,定义要存储的值是整数类型还是字符串类型

{
  "type" : "integer",
   "checked" : "1",
  "options" : {
  "1" : "Pratik Shrestha",
  "2" : "DRH2SO4"
            },
"style": {
  "color" : "red"
      }
}

简单图片字段设置自定义

{
  "image" : {
    "fit" : {
      "width" : "300",
      "height" : "300"
    },
    "quality" : "80"
  }
}

注意

当使用选择和单选按钮时,在自定义中提供选项对象是必需的

管理面板截图

Doctype Admin Setting Doctype Admin Setting Doctype Admin Setting

待办事项

  • 更好的配置文件控制
  • 可维护性
  • 更多灵活的自定义
  • 添加异常

使用的包

许可证

MIT

DOCTYPE NEPAL ||DR.H2SO4