php - Laravel IoC outside Laravel -


i using repo basis new cli php project using eloquent orm.

when create new eloquent capsule have option setasglobal makes db capsule accessible anywhere in code.

does mean there's laravel container being used? or affecting db object?

i'd been using pimple container, if laravel has container can bind via eloquent, lot simpler-- want bind log writer, eloquent capsule, , settings object global container can access anywhere.

no not use laravels container. if @ method in trait: (github.com)

public function setasglobal() {     static::$instance = $this; } 

you can see sets static property on class containing current instance reused subsequent calls.


Comments

Popular posts from this blog

angularjs - Redirect to a new template in angular js -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

Desktop Launcher for Python Script Starts Program in Wrong Path (Linux) -