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

html - height not adding height to a empty div -

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

python - Robot Framework location and name of keyword -