antto1 / laravel-admin-ext-config
laravel-admin 的配置扩展
v1.4.7.1
2020-09-28 07:38 UTC
Requires
- php: >=7.0.0
- antto1/laravel-admin: ^2.0|^3.0
- laravel/framework: ~5.5|~6.0
Requires (Dev)
- laravel/laravel: ~5.5|~6.0
- phpunit/phpunit: ~6.0
README
灵感来源于https://github.com/laravel-backpack/settings。
截图
安装
$ composer require antto1/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)
来获取配置的值。如果 image
有值,它将替代 value
值
许可
许可协议为 The MIT License (MIT)。