Home > other >  Middleware Return 500 in laravel
Middleware Return 500 in laravel

Time:07-19

Please I add middleware to my api Route. when i try to send request with post man it return

500 | SERVER ERROR

this is my code

Api Route:

Route::post('logout','AuthController@logout') -> middleware('auth.guard:admin-api');

guards:

   'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],


        'api' => [
            'driver' => 'jwt',
            'provider' => 'users',
            'hash' => false,
        ],


        'admin-api' => [
            'driver' => 'jwt',
            'provider' => 'admins',
        ],
    ],

In Kernal

    protected $routeMiddleware = [
     // ...
        'assign.guard' => \App\Http\Middleware\AssignGuard::class,
       
    ];
}

CodePudding user response:

Change middleware('auth.guard:admin-api') to middleware('assign.guard:admin-api'). thanks

  • Related