Laravel 4: Dynamic db selection using Capsule -


just trying understand how capsule works in laravel. works correctly defined, however, new page opened again take backs old connection information instead of new connection defined.

i believed setasglobal() makes available particular session atleast, however, guess conceptually wrong here.

it nice if can guide through right way make new database connection available globally via capsule, there various other ways, seems more promising.

it nice if explain following commands in more simpler way (the comments written per in documentation, however, above nice):

// set event dispatcher used eloquent models... (optional) $capsule->seteventdispatcher(new dispatcher(new container));   // set cache manager instance used connections... (optional) $capsule->setcachemanager(...);   // make capsule instance available globally via static methods... (optional) $capsule->setasglobal();    // setup eloquent orm... (optional; unless you've used seteventdispatcher())  $capsule->booteloquent(); 

any appreciated. thank you.

check answer @ https://stackoverflow.com/a/34837068/1216285 use capsule out of laravel scope in app. since laravel components decoupled , served independent components in laravel project, can use them in app easily.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -