Last active
June 8, 2016 08:18
-
-
Save duellsy/9983655 to your computer and use it in GitHub Desktop.
Confirming laravel artisan commands when in production, very raw at this stage, but works well.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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"; | |
exit; | |
} | |
echo "\n"; | |
echo "\033[0;32mThank you, continuing...\033[0m\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding htis to your artisan file will protect you like this: