Translatable route slug will return 404 after changing localization #475
Unanswered
amiraghyan99
asked this question in
Q&A
Replies: 1 comment
-
I resolved this issue by adding a map for routes based on slugs. However, this is not the expected behavior
and in localization change route
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel: 9.19
PHP: 8.2
spatie/laravel-sluggable: 3.6
spatie/laravel-translatable: 6.1
I am using routes with localization like this
/{locale}/posts/{post:slug}
so I have two uri for post
after changeing localization, url will redirect from /en/posts/qwerty to /fr/posts/ytrewq
I have route for change localization with this logic
also I have Middleware for localization
I this case user will reqirect correctly, but user will get 404 becouse in the route binding we have logic like
also I am changing $this->getLocale() for this logic in the Model
the $this->getLocale() does't correct for $value, so
$this->getLocale()
will be fr, but$value
will be qwertyIs there any functionality to fix translatable and sluggable routes?
Thanks SPATIE for large packages
Beta Was this translation helpful? Give feedback.
All reactions