arkadiusjonczek/laravel-command-dbcreate

There is no license information available for the latest version (1.0.1) of this package.

MySQL Database Create Command for Laravel.

1.0.1 2019-11-16 23:57 UTC

This package is auto-updated.

Last update: 2024-10-17 11:36:14 UTC


README

Simple Laravel Command for your project to create the mysql database with artisan.

Install

In your laravel project require the composer package with:

composer require arkadiusjonczek/laravel-command-dbcreate

After that the command will automatically be registered in your laravel project.

Usage

Run the command:

php artisan db:create

Make sure you have configured your database!

Laravel Artisan Docker workaround

If you use docker for your local development your database configuration in your .env might look like this:

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=databasename
DB_USERNAME=root
DB_PASSWORD=password

If you want to use artisan you have to go into your docker container.

But you can add the following lines at the top of your app/database.php file:

if (php_sapi_name() == 'cli' && getenv('APP_ENV') == 'local') {
    putenv('DB_HOST=127.0.0.1');
}

Now you can use artisan on your local machine without breaking your docker environment.