Language Of Laravel Resource Controller

- 1 answer

I'm from the Netherlands and I'm making a website using Laravel 5.2 in Dutch. I want to be able to use the Route::resource('test', 'testController') with Dutch names as the methods of the controller. So basically I want to change the following action names:

  1. /index becomes /thuis
  2. /create becomes /maken
  3. /store becomes /opslaan
  4. ...

and so on..

Is this possible and how would I do it? I don't want to create a single route for every possible action. Thanks in advance!



My package is ready for use. Just follow the instructions. Don't forget to set your locale to nl or in the future to another language.

You can call the resource routes like:

TranslatableRoute::resource('recipe', 'recepten', 'RecipeController');

Where the second argument is the translated name and the first defines the name of your routes.

See also: