asolenzal
asolenzal

Reputation: 500

Laravel 5 routing using prefix

Hi I'm building a Laravel 5 project that is to be deployed in a subfolder on a server inside a wordpress application(I don't know why but clients are clients), then I need to prefix all the routes from the application with a prefix like "/es", now the issue is with Auth related routes. In my routes definitions I have the following line:

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

And my question is, is there any way to prefix this routes without having to put all route definitions for the auth controller extracted from the trait that handles them?

Thanks in advance.

Upvotes: 5

Views: 2848

Answers (2)

marcanuy
marcanuy

Reputation: 23942

You can use a Route Prefix: http://laravel.com/docs/5.1/routing#route-group-prefixes

The prefix group array attribute may be used to prefix each route in the group with a given URI.

Upvotes: 2

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111829

You should probably for this route simply change auth and password to have prefix:

Route::controllers([
    'es/auth' => 'Auth\AuthController',
    'es/password' => 'Auth\PasswordController',
]);

If it doesn't help please provide detailed description what exactly doesn't work

Upvotes: 0

Related Questions