Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prohibitDestructiveCommands Method to Prevent Running Destructive Commands in Production #1996

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

alissn
Copy link
Contributor

@alissn alissn commented Dec 3, 2024

Hi,

In this pull request, I’ve added a prohibitDestructiveCommands method to the Module facade. This method allows you to indicate whether destructive Artisan commands should be prohibited, especially in production environments.

The commands affected are:

  • module:migrate-fresh
  • module:migrate-refresh
  • module:migrate-reset

Usage:

To enable this feature, add the following line to your service provider:

Module::prohibitDestructiveCommands($this->app->isProduction());

This ensures that these potentially harmful commands are disabled when running in a production environment, adding an extra layer of safety for your application.

Additionally, this PR updates the confirmable messages to provide clearer communication to users when running these commands.

Thanks.

@dcblogdev dcblogdev merged commit 79cdb18 into nWidart:master Dec 3, 2024
5 checks passed
@dcblogdev
Copy link
Collaborator

awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants