is there anyway I could setup(create) database from migration? I want to run migrate and seed, but beforehand it should create database first.
Any suggestions ?
Thanks
is there anyway I could setup(create) database from migration? I want to run migrate and seed, but beforehand it should create database first.
Any suggestions ?
Thanks
You could create custom artisan command and run it before migrate
command.
Inside the command use raw query, you can try something like this:
DB::statement('CREATE DATABASE :db', ['db' => $newDatabase]);
you can do this by new Artisan Command...
php artisan make:database {database-name} {connection-name}
but you have to creat this command first.
check this link