Execute a migration by passing parameters in Laravel 5

1

I am creating a robust application where I will define which commands will be executed within a database according to the subdomain (which is also the name of the client database). How can I pass this parameter to a Laravel migration? I'm looking for something like this:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDb extends Migration{

    public function up($dbname){
        DB::select( DB::raw( 'CREATE DATABASE :db', ['db'=>$dbname] ) );
    }

    public function down($dbname){
        DB::select( DB::raw( 'DROP DATABASE :db', ['db'=>$dbname] ) );
    }

}
    
asked by anonymous 28.11.2016 / 17:59

0 answers