Artisan Commands
- Utility commands
- module:clear-compiled
- module:composer-update
- module:dump
- module:use
- module:unuse
- module:list
- module:show-model
- module:migrate
- module:migrate-rollback
- module:migrate-refresh
- module:migrate-reset Blog
- module:seed
- module:publish-migration
- module:publish-config
- module:publish-translation
- module:lang
- module:enable
- module:delete
- module:disable
- module:update
- Generator commands
- module:make
- module:make
- module:make-action
- module:make-cast
- module:make-channel
- module:make-class
- module:make-command
- module:make-component
- module:make-component-view
- module:make-enum
- module:make-event-provider
- module:make-exception
- module:make-helper
- module:make-interface
- module:make-observer
- module:make-repository
- module:make-migration
- module:make-scope
- module:make-service
- module:make-seed
- module:make-trait
- module:make-controller
- module:make-model
Useful Tip:
You can use the following commands with the --help
suffix to find its arguments and options.
Note all the following commands use "Blog" as example module name, and example class/file names
#Utility commands
#module:clear-compiled
Remove the compiled bootstrap/cache/modules
file. Which is automatically created when not present.
This will refresh the cache contents.
It's recommended to run this command if you've made changes to the module_statuses.json
file.
php artisan module:clear-compiled
#module:composer-update
Update the composer.json file for the given module.
php artisan module:composer-update Blog
#module:dump
Run composer dump-autoload for a specific module or all modules.
php artisan module:dump Blog
#module:use
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 Blog
#module:unuse
This unsets the specified module that was set with the module:use
command.
php artisan module:unuse
#module:list
List all available modules.
php artisan module:list
#module:show-model
Provides a convenient overview of all the model's attributes and relations:
php artisan module:show-model Blog
#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
From version 10.1
To only back a specific migration use the option --subpath
php artisan module:migrate-rollback --subpath="2023_10_17_101427_create_posts_table.php" 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 translation files.
php artisan module:publish-translation Blog
#module:lang
Check missing language keys in the specified module.
php artisan module:lang Blog
#module:enable
Enable the given module.
php artisan module:enable Blog
#module:delete
Delete the given module.
php artisan module:delete 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
Generate a new module.
php artisan module:make Blog
#module:make
Generate multiple modules at once.
php artisan module:make Blog User Auth
#module:make-action
Create a new action class for a specific module.
php artisan module:make-action PublishPost Blog
#module:make-cast
Create a new Eloquent cast class for a specific module.
php artisan module:make-cast TitleCast Blog
#module:make-channel
Create a new channel class for a specific module.
php artisan module:make-channel NotificationChannel Blog
#module:make-class
Create a new class for a specific module.
php artisan module:make-class CustomClass Blog
#module:make-command
Generate the given console command for the specified module.
php artisan module:make-command CreatePostCommand Blog
#module:make-component
Generate the given component for the specified module.
php artisan module:make-component Alert Blog
#module:make-component-view
Generate a Blade component view file for a specific module.
php artisan module:make-component-view Alert Blog
#module:make-enum
Generate a new Enum class for a specific module.
php artisan module:make-enum PostStatus Blog
#module:make-event-provider
Generate an event service provider for a specific module.
php artisan module:make-event-provider EventServiceProvider Blog
#module:make-exception
Generate an exception class for a specific module.
php artisan module:make-exception PostNotFoundException Blog
#module:make-helper
Generate a helper class for a specific module.
php artisan module:make-helper StringHelper Blog
#module:make-interface
Generate a interface class for a specific module.
php artisan module:make-interface PostRepositoryInterface Blog
#module:make-observer
Generate a observer class for a specific module.
php artisan module:make-observer PostObserver Blog
#module:make-repository
Generate a repository class for a specific module.
php artisan module:make-repository PostRepository Blog
#module:make-migration
Generate a migration for specified module.
php artisan module:make-migration create_posts_table Blog
#module:make-scope
Generate a Eloquent query scope class for a specific module.
php artisan module:make-scope ActivePostsScope Blog
#module:make-service
Generate a service class for a specific module.
php artisan module:make-service PostService 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-trait
Generate a trait class for a specific module.
php artisan module:make-trait Sluggable Blog
#module:make-controller
Generate a controller for the specified module.
php artisan module:make-controller PostsController Blog
Optional options:
--plain
,-p
: create a plain controller--api
: create a resource controller
#module:make-model
Generate the given model for the specified module.
php artisan module:make-model Post Blog
Optional options:
-c, --controller Flag to create associated controllers--fillable[=FILLABLE] The fillable attributes.-f, --factory Create a new factory for the model-m, --migration Flag to create associated migrations-r, --request Create a new request for the model-s, --seed Create a new seeder for the model
Added in 12.0.1
-a, --all Flag to create all associated files-R, --resource Create a new resource for the model-p, --policy Create a new policy for the model ### module:make-provider Generate the given service provider name for the specified module. ```bashphp 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
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 Blogphp artisan module:make-listener NotifyUsersOfANewPost Blog --event=PostWasCreatedphp artisan module:make-listener NotifyUsersOfANewPost Blog --event=PostWasCreated --queued
#module:make-request
Generate the given request for the specified module.
php artisan module:make-request CreatePostRequest Blog
#module:make-event
Generate the given event for the specified module.
php artisan module:make-event BlogPostWasUpdated Blog
#module:make-job
Generate the given job for the specified module.
php artisan module:make-job JobName Blog php artisan module:make-job JobName Blog --sync # A synchronous job class
#module:route-provider
Generate the given route service provider for the specified module.
php artisan module:route-provider Blog
#module:make-factory
Generate the given database factory for the specified module.
php artisan module:make-factory ModelName Blog
#module:make-policy
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.policies
in modules.php
to your desired location.
php artisan module:make-policy PolicyName Blog
#module:make-rule
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 modules.php
to your desired location.
php artisan module:make-rule ValidationRule Blog
#module:make-resource
Generate the given resource class for the specified module. It can have an optional --collection
argument to generate a resource collection.
The Transformers
folder is not generated by default when creating a new module. Change the value of paths.generator.resource
in modules.php
to your desired location.
php artisan module:make-resource PostResource Blogphp artisan module:make-resource PostResource Blog --collection
#module:make-test
Generate the given test class for the specified module.
php artisan module:make-test EloquentPostRepositoryTest Blog
v11.0.1 added: make:view
#module:make-view
Generate the given view for the specified module.
php artisan module:make-view index Blog
Laravel Package built by Nicolas Widart.
Maintained by David Carr follow on X @dcblogdev