You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: container.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,6 +178,9 @@ $this->app->singletonIf(Transistor::class, function (Application $app) {
178
178
});
179
179
```
180
180
181
+
<aname="singleton-attribute"></a>
182
+
#### Singleton Attribute
183
+
181
184
Alternatively, you may mark an interface or class with the `#[Singleton]` attribute to indicate to the container that it should be resolved one time:
182
185
183
186
```php
@@ -217,6 +220,9 @@ $this->app->scopedIf(Transistor::class, function (Application $app) {
217
220
});
218
221
```
219
222
223
+
<aname="scoped-attribute"></a>
224
+
#### Scoped Attribute
225
+
220
226
Alternatively, you may mark an interface or class with the `#[Scoped]` attribute to indicate to the container that it should be resolved one time within a given Laravel request / job lifecycle:
221
227
222
228
```php
@@ -296,7 +302,7 @@ interface EventPusher
296
302
}
297
303
```
298
304
299
-
Furthermore, `Singleton` and `Scoped` attributes may be applied to indicate if the container bindings should be resolved once or once per request / job lifecycle:
305
+
Furthermore, [Singleton](#singleton-attribute) and [Scoped](#scoped-attribute) attributes may be applied to indicate if the container bindings should be resolved once or once per request / job lifecycle:
0 commit comments