From 2c91f6f5fd3f5d9c65dfbacdb239f9a2a679b83d Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Sun, 13 Jun 2021 16:23:04 -0300 Subject: [PATCH 1/2] Adds the scoped to the container contract --- src/Illuminate/Contracts/Container/Container.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Illuminate/Contracts/Container/Container.php b/src/Illuminate/Contracts/Container/Container.php index 710e7b15bb5d..134fa48ee192 100644 --- a/src/Illuminate/Contracts/Container/Container.php +++ b/src/Illuminate/Contracts/Container/Container.php @@ -81,6 +81,15 @@ public function singleton($abstract, $concrete = null); */ public function singletonIf($abstract, $concrete = null); + /** + * Register a scoped binding in the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function scoped($abstract, $concrete = null); + /** * "Extend" an abstract type in the container. * From e133ac0f7917340918d1c0a50bca658f41ac3d8d Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Mon, 14 Jun 2021 09:41:31 -0300 Subject: [PATCH 2/2] Add the scopedIf method to the container contract --- src/Illuminate/Contracts/Container/Container.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Illuminate/Contracts/Container/Container.php b/src/Illuminate/Contracts/Container/Container.php index 134fa48ee192..7d7f2c96a09f 100644 --- a/src/Illuminate/Contracts/Container/Container.php +++ b/src/Illuminate/Contracts/Container/Container.php @@ -90,6 +90,15 @@ public function singletonIf($abstract, $concrete = null); */ public function scoped($abstract, $concrete = null); + /** + * Register a scoped binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function scopedIf($abstract, $concrete = null); + /** * "Extend" an abstract type in the container. *