laravel5支持模块modules开发

发布时间:2019-12-03 20:55:12 阅读:956次
1.首先安装module命令支持进入cmd运行下面命令

composer require "pingpong/modules:~2.1"

2.待成功后修改config/app.php
找到相关键值添加
'providers' => array(
 'Pingpong\Modules\ModulesServiceProvider',
),
'aliases' => array(
  'Module' => 'Pingpong\Modules\Facades\Module',
),
然后运行命令 php artisan vendor:publish
出现
Copied File [\vendor\pingpong\modules\src\config\config.php] To [\config\modules
.php]
为成功 
php artisan 查看module已经在命令列表里了

3.添加自己的模块
php artisan module:make
创建多个模块
php artisan module:make Blog User Comment
使用指定的模块
php artisan module:use Blog
php artisan module:list 显示目录中的所有目录文件

创建控制器
php artisan module:make-controller SiteController blog
php artisan module:publish blog
php artisan module:publish

创建model
php artisan module:make-model User blog

创建中间键

php artisan module:make-middleware Auth

https://nwidart.com/laravel-modules/v1/advanced-tools/artisan-commands

Note all the following commands use "Blog" as example module name, and example class/file names

Utility commands
module:make
Generate a new module.

php artisan module:make Blog 
module:make
Generate multiple modules at once.

php artisan module:make Blog User Auth
module:use
Use a given module. This allows you to not specific the module name on other commands requiring the module name as an argument.

php artisan module:use Blog 
module:list
List all available modules.

php artisan module:list
module:migrate
Migrate the given module, or without a module an argument, migrate all modules.

php artisan module:migrate Blog 
module:migrate-rollback
Rollback the given module, or without an argument, rollback all modules.

php artisan module:migrate-rollback Blog 
module:migrate-refresh
Refresh the migration for the given module, or without a specified module refresh all modules migrations.

php artisan module:migrate-refresh Blog 
module:migrate-reset Blog
Reset the migration for the given module, or without a specified module reset all modules migrations.

php artisan module:migrate-reset Blog 
module:seed
Seed the given module, or without an argument, seed all modules

php artisan module:seed Blog 
module:publish-migration
Publish the migration files for the given module, or without an argument publish all modules migrations.

php artisan module:publish-migration Blog 
module:publish-config
Publish the given module configuration files, or without an argument publish all modules configuration files.

php artisan module:publish-config Blog 
module:publish-translation
Publish the translation files for the given module, or without a specified module publish all modules migrations.

php artisan module:publish-translation Blog 
module:enable
Enable the given module.

php artisan module:enable Blog 
module:disable
Disable the given module.

php artisan module:disable Blog 
module:update
Update the given module.

php artisan module:update Blog 
Generator commands
module:make-command
Generate the given console command for the specified module.

php artisan module:make-command CreatePostCommand Blog 
module:make-migration
Generate a migration for specified module.

php artisan module:make-migration create_posts_table Blog 
module:make-seed
Generate the given seed name for the specified module.

php artisan module:make-seed seed_fake_blog_posts Blog 
module:make-controller
Generate a controller for the specified module.

php artisan module:make-controller PostsController Blog 
module:make-model
Generate the given model for the specified module.

php artisan module:make-model Post Blog 
Optional options:

--fillable=field1,field2: set the fillable fields on the generated model
--migration, -m: create the migration file for the given model
module:make-provider
Generate the given service provider name for the specified module.

php artisan module:make-provider BlogServiceProvider Blog 
module:make-middleware
Generate the given middleware name for the specified module.

php artisan module:make-middleware CanReadPostsMiddleware Blog 
module:make-mail
Generate the given mail class for the specified module.

php artisan module:make-mail SendWeeklyPostsEmail Blog 
module:make-notification
Generate the given notification class name for the specified module.

php artisan module:make-notification NotifyAdminOfNewComment Blog 
module:make-listener Blog --event events
Generate the given listener for the specified module, base on an event

php artisan module:make-listener Blog --event events
module:make-request
Generate the given request for the specified module.

php artisan module:make-request
module:make-event
Generate the given event for the specified module.

php artisan module:make-event
module:make-job
Generate the given job for the specified module.

php artisan module:make-job
module:route-provider
Generate the given route for the specified module.

php artisan module:route-provider Blog


如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:laravel5支持模块modules开发 出自老鄢博客 | 欢迎分享