-
Notifications
You must be signed in to change notification settings - Fork 33
Commands
Tip: You can use the following commands with the --help
suffix to find its arguments and options.
Generate a new module.
php artisan module:make my-blog
Generate multiple modules at once.
php artisan module:make my-blog projects crm
Use a given module. This allows you to not specify the module name on other commands requiring the module name as an argument.
php artisan module:use my-blog
This unsets the specified module that was set with the module:use
command.
php artisan module:unuse
List all available modules.
php artisan module:list
Migrate the given module, or without a module an argument, migrate all modules.
php artisan module:migrate my-blog
Rollback the given module, or without an argument, rollback all modules.
php artisan module:migrate-rollback my-blog
Refresh the migration for the given module, or without a specified module refresh all modules migrations.
php artisan module:migrate-refresh my-blog
Reset the migration for the given module, or without a specified module reset all modules migrations.
php artisan module:migrate-reset my-blog
Seed the given module, or without an argument, seed all modules
php artisan module:seed my-blog
Publish the migration files for the given module, or without an argument publish all modules migrations.
php artisan module:publish-migration my-blog
Publish the given module configuration files, or without an argument publish all modules configuration files.
php artisan module:publish-config my-blog
Publish the translation files for the given module, or without a specified module publish all modules migrations.
php artisan module:publish-translation my-blog
Enable the given module.
php artisan module:enable my-blog
Disable the given module.
php artisan module:disable my-blog
Update the given module.
php artisan module:update my-blog
Generate the given console command for the specified module.
php artisan module:make-command CreatePostCommand my-blog
Generate a migration for specified module.
php artisan module:make-migration create_posts_table my-blog
Generate the given seed name for the specified module.
php artisan module:make-seed seed_fake_blog_posts my-blog
Generate a controller for the specified module.
php artisan module:make-controller Posts my-blog
Generate the given model for the specified module.
php artisan module:make-model Post my-blog
Optional options:
-
--fillable=field1,field2
: set the fillable fields on the generated model -
--migration
,-m
: create the migration file for the given model -
--factory
,-f
: create the factory file for the given model
Generate the given service provider name for the specified module.
php artisan module:make-provider Event my-blog
Generate the given middleware name for the specified module.
php artisan module:make-middleware CanReadPostsMiddleware my-blog
Generate the given mail class for the specified module.
php artisan module:make-mail SendWeeklyPostsEmail my-blog
Generate the given notification class name for the specified module.
php artisan module:make-notification NotifyAdminOfNewComment my-blog
Generate the given listener for the specified module. Optionally you can specify which event class it should listen to. It also accepts a --queued
flag allowed queued event listeners.
php artisan module:make-listener NotifyUsersOfANewPost my-blog
php artisan module:make-listener NotifyUsersOfANewPost my-blog --event=PostWasCreated
php artisan module:make-listener NotifyUsersOfANewPost my-blog --event=PostWasCreated --queued
Generate the given request for the specified module.
php artisan module:make-request CreatePostRequest my-blog
Generate the given event for the specified module.
php artisan module:make-event BlogPostWasUpdated my-blog
Generate the given job for the specified module.
php artisan module:make-job JobName my-blog
php artisan module:make-job JobName my-blog --sync # A synchronous job class
Generate the given database factory for the specified module.
php artisan module:make-factory FactoryName my-blog
Generate the given policy class for the specified module.
The Policies
is not generated by default when creating a new module. Change the value of paths.generator.policy
in config/module.php
to your desired location.
php artisan module:make-policy PolicyName my-blog
Generate the given validation rule class for the specified module.
The Rules
folder is not generated by default when creating a new module. Change the value of paths.generator.rules
in config/module.php
to your desired location.
php artisan module:make-rule ValidationRule my-blog
Generate the given API resource class for the specified module. It can have an optional --collection
argument to generate a resource collection.
The Http/Resources
folder is not generated by default when creating a new module. Change the value of paths.generator.resource
in config/module.php
to your desired location.
php artisan module:make-resource PostResource my-blog
php artisan module:make-resource PostResource my-blog --collection
Generate the given test class for the specified module.
php artisan module:make-test EloquentPostRepositoryTest my-blog
Generate the given view component for the specified module.
php artisan module:make-component MyAlert my-blog
Generate the given cast class for the specified module.
The Casts
is not generated by default when creating a new module. Change the value of paths.generator.cast
in config/module.php
to your desired location.
php artisan module:make-cast CastName my-blog
Generate the given observer class for the specified module.
The Observers
is not generated by default when creating a new module. Change the value of paths.generator.observer
in config/module.php
to your desired location.
php artisan module:make-observer ObserverName my-blog
php artisan module:make-observer ObserverName my-blog --model=Post
Optional options:
-
--model
,-m
: create the observer file for the given model
Generate the given exception class for the specified module.
The Exceptions
is not generated by default when creating a new module. Change the value of paths.generator.exception
in config/module.php
to your desired location.
php artisan module:make-exception ExceptionName my-blog