Last active
November 2, 2023 13:33
-
-
Save dhanar98/ce5bb95e76eeff7f2809358966f351bd to your computer and use it in GitHub Desktop.
Building Your First Laravel Application using Bash Script Just giving Name - Database Support in MYSQL , Need Install Breeze Just giving Yes
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
#!/bin/bash | |
# Step 1: Install Composer if not already installed | |
if ! [ -x "$(command -v composer)" ]; then | |
echo "Composer is not installed. Installing..." | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php composer-setup.php --install-dir=/usr/local/bin --filename=composer | |
php -r "unlink('composer-setup.php');" | |
fi | |
# Step 2: Create a new Laravel project | |
read -p "Enter your project name: " project_name | |
composer create-project --prefer-dist laravel/laravel "$project_name" | |
# Step 3: Change to the project directory | |
cd "$project_name" | |
# Step 4: Configure the environment | |
cp .env.example .env | |
# Modify the .env file to change the database name | |
sed -i "s/DB_DATABASE=laravel/DB_DATABASE=$project_name/g" .env | |
# MySQL database information | |
DB_USER="root" | |
DB_NAME="$project_name" | |
# Prompt the user for installing Laravel Breeze | |
read -p "Do you want to install Laravel Breeze (y/n)? " install_breeze | |
if [ "$install_breeze" = "y" ] || [ "$install_breeze" = "Y" ]; then | |
composer require laravel/breeze --dev | |
php artisan breeze:install | |
php artisan migrate | |
else | |
php artisan migrate | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment