29.07.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Service Container 128<br />

Lastly, but most importantly, you may simply “type-hint” the dependency in the constructor of a<br />

class that is resolved by the container, including controllers, event listeners, queue jobs, middleware,<br />

and more. In practice, this is how most of your objects are resolved by the container.<br />

The container will automatically inject dependencies for the classes it resolves. For example, you<br />

may type-hint a repository defined by your application in a controller’s constructor. The repository<br />

will automatically be resolved and injected into the class:<br />

.<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!