Define custom settings for the database in Laravel

0

My situation is next, I have several settings with the database defined in the file databade.php , so far so good. But there are some connections that require 'variable' data, such as the name of the bank.

My question is whether you can define this 'variable' data within the controller, as in the Codeigniter Framework.

    
asked by anonymous 07.12.2015 / 14:08

1 answer

1

You can do this:

$conn = array(
    'driver'    => 'mysql',
    'host'      => 'localhost',
    'database'  => 'DATABASE',
    'username'  => 'USERNAME',
    'password'  => 'SOME_PASSWORD',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
);

Config::set('database.connections.DB_CONFIG_NAME', $conn);

In this link you have other options.

    
07.12.2015 / 14:26