Created
January 26, 2015 14:36
-
-
Save kejyun/7b634912ddd76e7ff43d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Services\Pokemon; | |
// model/Services/Pokemon/PokemonServiceServiceProvider.php | |
use Illuminate\Support\ServiceProvider; | |
/** | |
* Register our pokemon service with Laravel | |
* 註冊我們的 pokemon 服務到 Laravel | |
*/ | |
class PokemonServiceServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Registers the service in the IoC Container | |
* 註冊服務到 IoC Container | |
*/ | |
public function register() | |
{ | |
// Binds 'pokemonService' to the result of the closure | |
// 在閉合函式中綁定 'pokemonService' | |
$this->app->bind('pokemonService', function($app) | |
{ | |
return new PokemonService( | |
// Inject in our class of pokemonInterface, this will be our repository | |
// 注入我們的 pokemonInterface 介面,這個會是我們的資源庫 | |
$app->make('Repositories\Pokemon\PokemonInterface') | |
); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment