Wallogit.com
2017 © Pedro Peláez
Create translatable resource routes
Create translatable resource routes for laravel, (*1)
Run the following command:, (*2)
composer require doitonlinemedia/translatableroutes "dev-master", (*3)
Next add the following provider to your app.php in the config folder under 'providers':, (*4)
Doitonlinemedia\Translatableroutes\TranslatableRoutesServiceProvider::class, (*5)
And add this line to 'aliases' in the same file:, (*6)
'TranslatableRoute' => Doitonlinemedia\Translatableroutes\TranslatableRouteFacade::class, (*7)
Finally run composer dump-autoload, (*8)
From now on you can use it like this in your route file:, (*9)
TranslatableRoute::resource('recipe', 'recepten', 'RecipeController');, (*10)
Grouping these routes still works!, (*11)
You can also use it like:, (*12)
TranslatableRoute::resource('recipe', trans('routes.recipes'), 'RecipeController');, (*13)
This way you will have different routes in different language, but always named the same. So if you use route('recipe.index') you'll always return the to the right page no matter what language., (*14)
Do not forget to set your locale to specific language you need e.g. \App::setLocale('nl'), (*15)
, (*16)
For now this package supports the English (default) and Dutch language., (*17)