chinleung / laravel-multilingual-routes

A package to handle multilingual routes in your Laravel application.
https://github.com/chinleung/laravel-multilingual-routes-demo
MIT License
394 stars 26 forks source link

Error when using Route::multilingual()->middleware() #39

Closed vaskolukas closed 4 years ago

vaskolukas commented 4 years ago

Describe the bug

I have this route:

Route::multilingual('/test', [TestController::class, 'index'])->middleware(['can:open something'])->name('test.index');

And I am receiving this error:

Call to undefined method ChinLeung\MultilingualRoutes\MultilingualRoutePendingRegistration::middleware()

Without attached middleware routes working fine.

chinleung commented 4 years ago

Hi @vaskolukas,

I'm going to have a look at the middleware method. For the moment, you can use this as a workaround:

Route::middleware(['can:open something'])->group(function () {
    Route::multilingual('/test', [TestController::class, 'index'])->name('test.index');
});
chinleung commented 4 years ago

The middleware method is available as of v2.6.0 and v1.9.0.