From 1796d71ce0b1eba45a66ef809b8bc546fa0f62fc Mon Sep 17 00:00:00 2001 From: Tigrov Date: Mon, 1 Jul 2024 17:57:37 +0700 Subject: [PATCH] Add soc about config for middleware --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 70b4eb0a2..208ac78de 100644 --- a/README.md +++ b/README.md @@ -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