Laravel – Set up on Local by Flywheel
-
Set up a new site on Laravel
Ensure to use to use a PHP version greater than 7.2.5
-
Bash into the site (right click on container - Open Site SSH)
-
Download the installer
https://getcomposer.org/installer
-
Copy installer to /app folder (in Explorer)
-
Bash into the /app folder and run the following commands..
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=../bin --filename=composer
php -r "unlink('composer-setup.php');" -
Install Laravel globally
composer global require laravel/installer -
Run the following commands so that Laravel can be accessed via the terminal
export PATH="~/.composer/vendor/bin:$PATH"
source ~/.bashrc
OR FOR SOME LINUX SETUPS
export PATH="~/.config/composer/vendor/bin:$PATH"
source ~/.bashrc -
Delete the public folder within project name/app (via windows explorer)
-
Return to the bash and revert to the parent folder
cd .. -
Create a new laravel project
laravel new app --force -
Update .env
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_SOCKET="/Users/yourusername/Library/Application Support/Local/run/lkIEkdiowIEkmd/mysql/mysqld.sock"
DB_DATABASE=local
DB_USERNAME=root
DB_PASSWORD=root -
Make fix for mariadb
Update app/Providers/AppServiceProvider.php (add following code)
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
} -
Run migrations
php artisan migrate -
Stop local site and delete /app folder (use rimraf if experiencing issues)
-
Pull repo into a new /app folder
-
Start site and install packages via the bash
cd /app
composer install -
Run migrations (FRESH)
php artisan migrate:fresh