Skip to content

Commit 81e29b1

Browse files
committed
allow bindings and singletons properties
1 parent f16d2c0 commit 81e29b1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Illuminate/Foundation/Application.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -586,15 +586,18 @@ public function register($provider, $options = [], $force = false)
586586
$provider->register();
587587
}
588588

589-
if (property_exists($provider, 'bind')) {
590-
foreach ($provider->bind as $abstract => $concrete) {
591-
$this->bind($abstract, $concrete);
589+
// If there are bindings / singletons set as properties on the provider we
590+
// will spin through them and register them with the application, which
591+
// serves as a convenience layer while registering a lot of bindings.
592+
if (property_exists($provider, 'bindings')) {
593+
foreach ($provider->bindings as $key => $value) {
594+
$this->bind($key, $value);
592595
}
593596
}
594597

595598
if (property_exists($provider, 'singletons')) {
596-
foreach ($provider->singletons as $abstract => $concrete) {
597-
$this->singleton($abstract, $concrete);
599+
foreach ($provider->singletons as $key => $value) {
600+
$this->singleton($key, $value);
598601
}
599602
}
600603

0 commit comments

Comments
 (0)