Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Confirming laravel artisan commands when in production, very raw at this stage, but works well.
// Adding this to your app/artisan.php file will
// do a quick confirmation that you really do want
// to run this command when in production environment
if (App::environment() === 'production') {
echo "\033[0;33m======== WARNING ========\n";
echo "===== IN PRODUCTION =====\n";
echo "=========================\n";
echo "Are you sure you want to do this? (y/n)\033[0m ";
$line = fgets(STDIN);
if(trim($line) != 'y'){
echo "\033[0;32mABORTING... few!\033[0m\n";
echo "\n";
echo "\033[0;32mThank you, continuing...\033[0m\n";

This comment has been minimized.

Copy link
Owner Author

duellsy commented Apr 4, 2014

Adding htis to your artisan file will protect you like this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.