dillingham / nova-ajax-select

Ajax select / child select package for Laravel Nova
MIT License
86 stars 22 forks source link

Using 'nova' middleware causes 401 #18

Open lonnylot opened 4 years ago

lonnylot commented 4 years ago

Using the nova middleware is causing a 401:

Route::group(['middleware' => ['nova'], 'namespace' => 'Api'], function() {
    Route::get('city/{city}/neighborhoods', 'CityNeighborhoodController@show');
});

I am successfully logged in on Nova v2.11.1

When I take out the middleware it works correctly. I do not have any policies for the models or other auto for the controller.

nataliiaVasiuk commented 3 years ago

@lonnylot Any decisions? I have the same issue.

jonrobinson commented 3 years ago

@nataliiaVasiuk This is what works for me. Create a separate file for this route and update RouteServiceProvider.php

Route::prefix('api')
             ->middleware('nova')
             ->namespace($this->namespace)
             ->group(base_path('routes/api_nova.php'));

My Route:

Route::get('resources/{resource}/price-lists', 'ResourcePricelistController@list');