Delete a module
To remove the Blog module from your application, roll back its migrations and run module:delete. The command deletes the module folder and removes its entry from the activator.
-
Roll back the module’s migrations first. Once the module folder is deleted, its migration files are gone and cannot be rolled back.
Terminal window php artisan module:migrate-reset Blog -
Delete the module.
Terminal window php artisan module:delete Blogmodule:deleteasks for confirmation in every environment. Pass--forceto skip the prompt:Terminal window php artisan module:delete Blog --forceList multiple names to delete several modules, or pass
--allto delete every module. -
Rebuild the autoloader so Composer drops the deleted module’s classes.
Terminal window composer dump-autoload -
Check the result.
Terminal window php artisan module:listBlogno longer appears in the list,Modules/Blogis gone, andmodules_statuses.jsonno longer containsBlog.
module:delete removes only the module folder and its status entry. Manually delete any files you published out of the module, such as assets in public/modules/blog, published migrations, or published translations.
Related
Section titled “Related”module:deletemodule:migrate-reset- Confirmation and prohibition:
Module::prohibitDestructiveCommands()blocksmodule:delete - Events:
deletinganddeleted - Disable a module instead