Slide 14
Slide 14 text
/* Laravel */
class VoitureServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind('moteur', function (): Moteur {
return new Moteur('standard');
});
$this->app->bind('v8', new Moteur('v8'));
$this->app->bind('voiture', function (Application $app): Moteur {
return new Voiture($app->make('v8'));
});
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14