From 81e29b1f09af7095df219efd18185f0818f5b698 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 10 Nov 2017 11:10:11 -0600 Subject: [PATCH] allow bindings and singletons properties --- src/Illuminate/Foundation/Application.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index fbaade3f9609..78c4e05c57c1 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -586,15 +586,18 @@ public function register($provider, $options = [], $force = false) $provider->register(); } - if (property_exists($provider, 'bind')) { - foreach ($provider->bind as $abstract => $concrete) { - $this->bind($abstract, $concrete); + // If there are bindings / singletons set as properties on the provider we + // will spin through them and register them with the application, which + // serves as a convenience layer while registering a lot of bindings. + if (property_exists($provider, 'bindings')) { + foreach ($provider->bindings as $key => $value) { + $this->bind($key, $value); } } if (property_exists($provider, 'singletons')) { - foreach ($provider->singletons as $abstract => $concrete) { - $this->singleton($abstract, $concrete); + foreach ($provider->singletons as $key => $value) { + $this->singleton($key, $value); } }