Where is the middleware key for Laravel Sanctum defined?

  laravel, laravel-sanctum, php

To protect and authenticate all incoming routes in Laravel using Sanctum, we have to attache the sanctum authentication guard to our routes within routes/api.php route files:

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

My question is about the middleware key auth:sanctum. Where is it defined/registered?

Source: Laravel

Leave a Reply