本文介绍了在路由中使用中间件的舰队购物车,但是我在项目中找不到任何$ routemiddleware ...甚至在kernel.php中也找不到...在哪里可以找到它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

车队在路线中使用中间件,但是我在项目中找不到任何$ routemiddleware ...甚至在kernel.php中也没有找到...

Laravel版本:5.7


护照版本:7.5


CMS:FleetCart


Kernel.php

 命名空间FleetCart \ Http;使用Illuminate \ Foundation \ Http \ Kernel作为HttpKernel;类内核扩展HttpKernel{/***应用程序的全局HTTP中间件堆栈.**这些中间件在对您的应用程序的每次请求期间运行.** @var数组*/受保护的$ middleware = [\ FleetCart \ Http \ Middleware \ CheckForMaintenanceMode :: class,\ Illuminate \ Foundation \ Http \ Middleware \ ValidatePostSize :: class,\ FleetCart \ Http \ Middleware \ TrimStrings :: class,\ Illuminate \ Foundation \ Http \ Middleware \ ConvertEmptyStringsToNull :: class,\ FleetCart \ Http \ Middleware \ TrustProxies :: class,\ FleetCart \ Http \ Middleware \ RedirectToInstallerIfNotInstalled :: class,\ FleetCart \ Http \ Middleware \ RunUpdater :: class,];/***应用程序的路由中间件组.** @var数组*/受保护的$ middlewareGroups = ['web'=>[\ FleetCart \ Http \ Middleware \ EncryptCookies :: class,\ Illuminate \ Cookie \ Middleware \ AddQueuedCookiesToResponse :: class,\ Illuminate \ Session \ Middleware \ StartSession :: class,\ Illuminate \ View \ Middleware \ ShareErrorsFromSession :: class,\ FleetCart \ Http \ Middleware \ VerifyCsrfToken :: class,\ Illuminate \ Routing \ Middleware \ SubstituteBindings :: class,],'api'=>['throttle:60,1',绑定",],];/***应用程序的路由中间件.**这些中间件可以分配给组,也可以单独使用.** @var数组*/受保护的$ routeMiddleware = ['bindings'=>\ Illuminate \ Routing \ Middleware \ SubstituteBindings :: class,'throttle'=>\ Illuminate \ Routing \ Middleware \ ThrottleRequests :: class,];} 

\ Modules \ Accounts \ Routes \ public.php

  Route :: middleware('auth')-> group(function(){路线:: get('account','AccountDashboardController @ index')-> name('account.dashboard.index');路线:: get('account/profile','AccountProfileController @ edit')-> name('account.profile.edit');路线:: put('account/profile','AccountProfileController @ update')-> name('account.profile.update');路线:: get('account/orders','AccountOrderController @ index')-> name('account.orders.index');路线:: get('account/orders/{id}','AccountOrderController @ show')-> name('account.orders.show');路线:: get('account/wishlist','AccountWishlistController @ index')-> name('account.wishlist.index');路线:: delete('account/wishlist/{productId}','AccountWishlistController @ destroy')-> name('account.wishlist.destroy');路线:: get('account/reviews','AccountReviewController @ index')-> name('account.reviews.index');}); 

中间件("auth")来自哪里?没有任何其他内核文件,也没有任何其他中间件表示形式.没有什么.....!!

寻求帮助!

解决方案

auth 中间件已注册在 Modules/Core/Providers/CoreServiceProvider.php 文件中./p>

检查 registerMiddleware()方法.

Fleet cart using middlewares in routes but i can not find any $routemiddleware in project...not even in kernel.php ...where can i find it?

Laravel Version : 5.7


Passport Version : 7.5


CMS : FleetCart


Kernel.php


namespace FleetCart\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \FleetCart\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \FleetCart\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \FleetCart\Http\Middleware\TrustProxies::class,
        \FleetCart\Http\Middleware\RedirectToInstallerIfNotInstalled::class,
        \FleetCart\Http\Middleware\RunUpdater::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \FleetCart\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \FleetCart\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    ];
}

\Modules\Accounts\Routes\public.php

Route::middleware('auth')->group(function () {
    Route::get('account', 'AccountDashboardController@index')->name('account.dashboard.index');

    Route::get('account/profile', 'AccountProfileController@edit')->name('account.profile.edit');
    Route::put('account/profile', 'AccountProfileController@update')->name('account.profile.update');

    Route::get('account/orders', 'AccountOrderController@index')->name('account.orders.index');
    Route::get('account/orders/{id}', 'AccountOrderController@show')->name('account.orders.show');

    Route::get('account/wishlist', 'AccountWishlistController@index')->name('account.wishlist.index');
    Route::delete('account/wishlist/{productId}', 'AccountWishlistController@destroy')->name('account.wishlist.destroy');

    Route::get('account/reviews', 'AccountReviewController@index')->name('account.reviews.index');
});

Where that middleware('auth') came from? there is not anyother kernel files not anyother middleware representations. nothing.....!!

Looking for help!

解决方案

The auth middleware is registered in the Modules/Core/Providers/CoreServiceProvider.php file.

Check the registerMiddleware() method.

这篇关于在路由中使用中间件的舰队购物车,但是我在项目中找不到任何$ routemiddleware ...甚至在kernel.php中也找不到...在哪里可以找到它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 13:12