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

Not detecting 'as' in routes #67

Closed criting closed 2 years ago

criting commented 2 years ago

Describe the bug

Using 'as' in the route doesn't work and the blade file cannot find it. Example

Route::multilingual('food', ['as' => 'food:list', 'uses' => 'FoodController@index']);

Getting Route [food:list] not defined. error

Shouldn't this work by default? it is only used so we don't need to change the route url in the blade files, but actually calling them by unique name.

chinleung commented 2 years ago

Hi @criting,

This is old Laravel syntax.

You can achieve it this way:

Route::multilingual('food', 'FoodController@index')->name('food:list');

Which will generate {$locale}.food:list as a route.

You can then confirm with php artisan route:list command.