Laravel по-русски

Русское сообщество разработки на PHP-фреймворке Laravel.

Ты не вошёл. Вход тут.

#1 Re: Lumen » [dev-разработка] , не для production - автоочистка от view-cache » Вчера 07:48:21

Hello,

To include your custom ClearViewCacheMiddleware in your Lumen application's bootstrap/app.php file, you'll need to add it to the middleware stack. Here's how you can do it:

First, ensure that the middleware file is correctly placed in your project directory: /app/Http/Middleware/ClearViewCacheMiddleware.php.

Then, in your bootstrap/app.php file, add the following line to the $app->middleware() array to include your custom middleware:

php
$app->middleware([
    // Other middlewares...
    App\Http\Middleware\ClearViewCacheMiddleware::class,
    Laravel\Lumen\Http\Middleware\VerifyCsrfToken::class,
]);
This will ensure that the ClearViewCacheMiddleware is executed with each request, and it will clear the cached views as defined in your middleware class.

Подвал раздела