Last active
August 1, 2021 19:20
-
-
Save dimitriacosta/d8dd4d65ed49ba156e549dcf9458e031 to your computer and use it in GitHub Desktop.
Creates a new laravel project, initializes a git repository, creates its database and open in browser and editor
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
function laramagic { | |
PROJECT=$1 | |
echo "Creating a new Laravel project: $PROJECT..." | |
cd ~/code | |
composer create-project laravel/laravel $PROJECT | |
cd $PROJECT | |
git init | |
git add . | |
git commit -m "Install Laravel" | |
mysql -u root -e "CREATE DATABASE $PROJECT" | |
sed -i'.original' -e "s/DB_DATABASE=homestead/DB_DATABASE=$PROJECT/g" .env | |
sed -i'.original' -e "s/DB_USERNAME=homestead/DB_USERNAME=root/g" .env | |
sed -i'.original' -e "s/DB_PASSWORD=secret/DB_PASSWORD=/g" .env | |
php artisan migrate | |
open "http://$PROJECT.test" | |
code . | |
rm .env.original | |
echo "$PROJECT project created succesfully" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment