Skip to content

Commit

Permalink
Add soc about config for middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Jul 1, 2024
1 parent cadcd07 commit 1796d71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@ Route::methods([Method::GET, Method::POST], '/user/register')
->name('user/register');
```

Or, if you use `yiisoft/config` and `yiisoft/middleware-dispatcher` packages, add the middleware to the configuration,
for example in `config/common/params.php` file:

```php
use Yiisoft\ActiveRecord\ConnectionProviderMiddleware;

return [
'middlewares' => [
ConnectionProviderMiddleware::class,
],
];
```

_For more information about how to configure middleware, follow [Middleware Documentation](https://github.com/yiisoft/docs/blob/master/guide/en/structure/middleware.md)_

Now you can use the Active Record in the action:

```php
Expand Down

0 comments on commit 1796d71

Please sign in to comment.