You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be great to be able to toggle this behaviour in Ziggy config, maybe discern between route params and query params and be able to toggle either for flexibility
Ziggy call and context
// How I expected to use ZiggyconstgoToCategory=(url)=>{// url = 'mens/blazers'Inertia.visit(route('catalog',{slug: url});}// How I am working around the issue currentlyconstgoToCategory=(url)=>{// url = 'mens/blazers'constroute=decodeURIComponent(route('catalog',{slug: url})Inertia.visit(route);}
Route::get('/{slug}', [ContentController::class, 'view'])->where('slug', '.*')->name('catalog');
//n.b. the store parameter is added within the RouteServiceProvider as a prefix.
The text was updated successfully, but these errors were encountered:
Thanks for the heads up! I think you're right that this should either be configurable or we should automatically do what Laravel does and not encode it if it's the very last route parameter. I'll look into this.
@just-tom I'm coming back to this while digging into #661 and realizing that example.com/mens%2Fblazers and example.com/mens/blazers are actually functionally identical, and both will work exactly the same way with Laravel. Was your issue here that example.com/mens%2Fblazers didn't work correctly? Or just that you wanted / displayed in the URL instead of %2F?
Id I remember correctly it was because i wanted to be able to display the / correctly as mens/blazers without seeing the encoding. e.g. if I stored a customer built "mega menu" in a DB somewhere and that was stored with a path like "mens/blazers" the when building a uri for the path it should accommodate it not encode it using a {{slug}} route
Thats from memory what the issue was to begin with but its been a long while haha!
Ziggy version
1.4.2
Laravel version
8.75.0
Description
Hi guys,
In this merge you enabled the encoding of all params and queries by default: #118
This poses a problem when using a route parameter where a forward slash is expected. Laravel can handle this as shown here: https://laravel.com/docs/8.x/routing#parameters-encoded-forward-slashes - but ziggy encodes the url before hand.
Actual result:
Expected Result:
Would be great to be able to toggle this behaviour in Ziggy config, maybe discern between route params and query params and be able to toggle either for flexibility
Ziggy call and context
Ziggy configuration
Route definition
The text was updated successfully, but these errors were encountered: