This forum has moved to a new location and is in read-only mode. Please visit to access the new location.


I want to do something like Multisites plugin does for themes, but for the database too.

Depending of the domain used, I want to set a different database, same host, user and pass, just another database name.

How can I do that?

Already tried Config::set('database.mysql.database', 'blah') at plugins public function boot(), but doesn't work


Did it at config.php level.

'database' => (function(){
    $host = Request::getHost();

    if (preg_match('/blah/', $host)) {
        return env('BLAH_DB_DATABASE');

    return env('DB_DATABASE', 'database');

But it is something we, in Brazil, like to call: Gambiarra.

Would be nice to have a proper way to do that.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to