Skip to content

Instantly share code, notes, and snippets.

@duellsy
Last active June 8, 2016 08:18
Show Gist options
  • Save duellsy/9983655 to your computer and use it in GitHub Desktop.
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.
<?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";
}
@duellsy
Copy link
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