attrox / config-controller
该软件包提供了一个快速的前端管理界面,用于更新Laravel配置文件。
Requires
- laravel/framework: ~5.1
- laravelcollective/html: ~5.1
This package is not auto-updated.
Last update: 2024-09-25 23:29:13 UTC
README
该软件包提供了一个快速的前端管理界面,用于更新Laravel配置文件。
这是为那些希望快速获得类似于“CMS”的管理界面来控制某些网页显示的开发者而设计的。只需设置Laravel配置文件并公开页面名称(缩写),管理员更新将会将信息写回Laravel配置文件,保持配置文件的结构和注释不变。
使用说明
将 vendor/attrox/config-controller/config/configcontroller.php
复制到Laravel的 config/
文件夹。
添加 slug
名称。这应该代表面向网页的页面名称和管理界面页面名称。
为 slug
添加 input
和 content
数组中的条目,有关更多详细信息,请参阅 configcontroller.php
中的注释。
扩展 Attrox\ConfigController\Controllers\AbstractController
并将 admin($slug)
和 adminPost($slug)
暴露给您的路由,以提供对配置管理界面的访问。
调整控制器属性(如有必要)
protected $config_base = 'configcontroller'; // This is mapped to Laravel config/configcontroller.php protected $admin_view = 'config_admin'; // This is the blade view used by the admin protected $index_view = '';
在此控制器中添加一个方法以返回动态网页。 getSlugContent($slug)
将返回您可以在视图中操作的内容。
添加类似的路由如下
$router->get('/test/{slug}', 'YourControllerClass@admin'); $router->post('/test/{slug}', 'YourControllerClass@adminPost'); $router->get('/dynamic/{$slug}', 'YourControllerClass@index');
将 vendor/attrox/config-controller/views/config_admin.blade.php
复制到您的视图文件夹。这是一个示例管理界面视图,您可以在主视图中包含它。
依赖关系
此软件包依赖于 October\Rain\Config\Repository
软件包 (https://github.com/attrox/laravel-config-writer)。这是一个我从 https://github.com/daftspunk/laravel-config-writer 分支出来的软件包,以与Laravel 5.x协同工作。
"require": {
"laravelcollective/html": "5.1.*"
}
需要使 Form
门面可用 (https://laravelcollective.com/docs/5.1/html)