Skip to content

[12.x] Add proper links #10706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion container.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ $this->app->singletonIf(Transistor::class, function (Application $app) {
});
```

<a name="singleton-attribute"></a>
#### Singleton Attribute

Alternatively, you may mark an interface or class with the `#[Singleton]` attribute to indicate to the container that it should be resolved one time:

```php
Expand Down Expand Up @@ -217,6 +220,9 @@ $this->app->scopedIf(Transistor::class, function (Application $app) {
});
```

<a name="scoped-attribute"></a>
#### Scoped Attribute

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:

```php
Expand Down Expand Up @@ -296,7 +302,7 @@ interface EventPusher
}
```

Furthermore, `Singleton` and `Scoped` attributes may be applied to indicate if the container bindings should be resolved once or once per request / job lifecycle:
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:

```php
use App\Services\RedisEventPusher;
Expand Down