Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ArneDB's avatar

How to use {lang} in Route::resource

I'm trying to use lang parameter in my resource route, but how do I handle this. I have this right now:

Route::resource('pigeon/{lang}', 'PigeonController');

But this provides some very bad routes :P routes

I have been looking here: https://laravel.com/docs/5.7/localization But I can't seem to find it.

0 likes
6 replies
ArneDB's avatar

@D9705996 - Hello there,

Yes I've seen that, but that is talking about translating the standard route things like, create, show, edit.

It's not about how to put a lang prefix in the url, like /en/, /pt/

You think there's somewhere in the documentation an explanation about that?

D9705996's avatar

Srry thats what I meant. e.g. /en/pigeon

Just from your post pigeon/{lang} would be /pigeon/en

ArneDB's avatar

@D9705996 - Oh I see now, yep that's totally my fault. You are right!

1 like

Please or to participate in this conversation.