Integrate plugin middleware
Since s-cart/core 6.4.1, middleware group of "front, admin" defined in "vendor/s-cart/core/Config/middleware.php"
The following example will automatically add middleware to the "front" group:
In the plugin's Provider.php file:
Therefore, the middleware in the plugin can be easily integrated into the "front, admin" middleware, by adding a new middleware value in the corresponding group.return [
'admin' => [
1 => 'admin.auth',
2 => 'admin.permission',
3 => 'admin.log',
4 => 'admin.storeId',
5 => 'admin.theme',
6 => 'localization',
],
'front' => [
1 => 'localization',
2 => 'currency',
3 => 'checkdomain',
],
];
The following example will automatically add middleware to the "front" group:
In the plugin's Provider.php file:
app('router')->aliasMiddleware('password_website', \App\Plugins\Other\PasswordWebsite\Middleware::class); // define a new middleware
//Add new middleware to group "front"
$configDefault = config('middleware.front');
$configDefault[] = 'password_website';
config(['middleware.front' => $configDefault]);
Related topics
Latest Document
- Upgrade guide 2024-03-24
- Customize search page 2023-08-02
- Discount code (coupon) 2023-05-14
- Upgrade guide 2023-11-23
- Data relations in S-Cart 2023-02-05