laravel-admin 的配置扩展

v1.3 2022-07-05 13:07 UTC

This package is auto-updated.

Last update: 2024-09-05 17:58:03 UTC


README

StyleCI Packagist Total Downloads Pull request welcome

灵感来自 https://github.com/laravel-backpack/settings

英文文档 | 中文文档

截图

wx20170810-100226

安装

$ composer require laravel-admin-ext/config

$ php artisan migrate

打开 app/Providers/AppServiceProvider.php 文件,并在 boot 方法中调用 Config::load() 方法

<?php

namespace App\Providers;

use Encore\Admin\Config\Config;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        $table = config('admin.extensions.config.table', 'admin_config');
        if (Schema::hasTable($table)) {
            Config::load();
        }
    }
}

然后执行

$ php artisan admin:import config

打开 http://your-host/admin/config

使用方法

在面板中添加配置后,使用 config($key) 来获取配置的值。

许可证

许可协议为 MIT 许可证 (MIT)