Level 3
Can you Post some code ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have built a rest api using laravel passport on which only api:auth middleware works. But whenever I make a new middleware and register it into kernel file and apply on anny route it doesnt work? Is there any other way for registering middlewares for api routes
Try like this
Route::middleware(['auth:api', 'my_md'])->group(function () {
Route::get('customer-profile','API\CustomerController@profile');
});
Please or to participate in this conversation.