mardi 25 octobre 2016

Laravel 5 - Registering Service Container in a Service Provider

In Laravel 4, to glue my repositories and interfaces together, I have an ioc.php file that looks like:

App::bind('UserInterface', 'UserRepository');
App::bind('ProjectInterface', 'ProjectRepository');

I can then register this file in my application by adding

require app_path() . '/ioc.php';

to the global.php file.

I understand that IOC has been renamed to Service Container in Laravel 5. I also noticed that global.php is no longer present.

How would I register my ServiceContainer.php file with my repository and interface bindings in Laravel 5?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire