Download the PHP package an5dy/laravel-admin-modules without Composer
On this page you can find all versions of the php package an5dy/laravel-admin-modules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package laravel-admin-modules
laravel-admin-modules
laravel-admin-modules 用于简单地按自定义模块来拆分基于 laravel-admin 开发的后台项目,也支持模块的按需载入。
需求环境
- PHP >= 7.0.0
- laravel-admin >= 1.6
安装
💡 建议安装在 dev 下,正式线不需要安装。
使用
首先新建一个模块
- name:模块名
模块初始目录结构
- app/{模块名}:目录用于存放相关模块文件。
- app/{模块名}/Controllers:目录用于存放模块控制器文件。
- app/{模块名}/Models:目录用于存放模块模型文件。
- app/{模块名}/Providers:目录用于存放模块服务提供者文件,{模块名}ServiceProvider.php 文件是当前模块的 laravel 服务提供者类,用于加载模块路由等功能,需手动注册到 config/app.php 配置文件中。
- app/{模块名}/routes.php:文件用于配置模块路由。
创建指定模块控制器类
- module:需创建控制器的模块名。
- model:当前模块 Models 目录下的模型名,可通过以下命令来生成。
php artisan make:model App\{模块名}\Models\{模型名}
- 其它参数与 laravel-admin admin:make 一致。
创建指定模块表单请求类
- module:需创建表单请求类的模块名。
- name:表单请求类名称。
创建指定模块服务提供者类
- module:需创建服务提供者类的模块名。
- name:服务提供者类名称。
创建指定模块 bootstrap.php 配置文件
- module:需创建 bootstrap.php 的模块名。
以上命令执行后的模块目录结构
-
app/{模块名}/Middleware/ModuleBootstrap.php:当前模块的 bootstrap.php 文件重载中间件,需配置在 {模块名}ServiceProvider.php 中,具体代码如下所示。
- app/{模块名}/bootstrap.php:当前模块 bootstrap.php 文件,不受 laravel-admin 和其他模块的 bootstrap.php 影响,功能与 laravel-admin bootstrap.php 一致,具体参考官网。
License
MIT
All versions of laravel-admin-modules with dependencies
PHP Build Version
Package Version
The package an5dy/laravel-admin-modules contains the following files
Loading the files please wait ....