Does anyone have any idea about this exception?
Route::group(['middleware' => 'auth:api'], function() {
//Blog routes
Route::get('blog', 'ApiControllers\ApiBlogController@index')->name('blog.index')->withoutMiddleware('auth:api');
//User routes
Route::get('user', 'ApiControllers\ApiUserController@index')->name('user.index');
Route::delete('user/{user}', 'ApiControllers\ApiUserController@destroy')->name('user.destroy');
Route::get('user/{user}', 'ApiControllers\ApiUserController@show')->name('user.show');
Route::put('user/{user}', 'ApiControllers\ApiUserController@update')->name('user.update');
});
BadMethodCallException: Method Illuminate\Routing\Route::withoutMiddleware does not exist. in file
WithoutMiddleware is a trait used in testing. Also there is a method named withoutMiddleware in this trait used for testing.
If you want to exclude a route from middleware you may remove blog-routes from route group of auth:api middleware such as
Route::get('blog', 'ApiControllers\ApiBlogController@index')->name('blog.index');
Route::group(['middleware' => 'auth:api'], function() {
// other routes
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With