Laravel Classroom image

Prashant  Nigam / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|Last
Lessons:-The IoC Container

20.2 Resolving Objects
Now we have our disco ball registered, let’s see how we can get it back. Let’s make a call to
resolve.
1 <?php
2 $db = IoC::resolve('discoball');
And that’s it! Instead of creating and configuring a new instance of our discoball each time, we
make a call to the resolve() method, passing the string that identifies the object and the IoC
container will execute the closure we created in the first section, and return our instantiated and
configured discoball object.
Handy, and saves many lines of code!
You can register and resolve as many objects as you want, go ahead and try it. For now lets
move on to singletons.

 
 
 

Prashant  Nigam

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)