Comments (6)
I'll tag another release for this shortly. Thanks for your help @tmannherz!
from ziggy.
What's your actual route path? Is it at the root of your app's domain, so the entire URI is literally {catalog_uri}
?
I'm adding tests for this to Ziggy and testing it in a real app too and I actually can't reproduce your exact examples. Laravel and Ziggy are behaving the same way for me, but they both behave differently if the route parameter is right at the root of the domain:
Route::get('{catalog_uri}', fn() => '')->where('catalog_uri', '^/p/.+$')->name('catalog1');
Route::get('catalog/{catalog_uri}', fn() => '')->where('catalog_uri', '^/p/.+$')->name('catalog2');
Both Laravel and Ziggy produce the same output for these:
route('catalog1', '/p/test'): http://example.com/p/test
route('catalog2', '/p/test'): http://example.com/catalog//p/test
from ziggy.
@bakerkretzmar The catalog routes are bound to a different domain, which is why these routes existing at all, so we can generate them correctly with the alternate domain.
Route::domain('catalog.example.com')->group(function () {
Route::get('{catalog_uri}', fn() => view('pdp'))
->where('catalog_uri', '^/p/.+$')
->name('pdp');
});
Does that answer your question?
from ziggy.
Yeah it does, thanks. I can't reproduce this at all then. When I add a route with the exact configuration you shared to Ziggy's tests or to one of my own apps, Ziggy's route('catalog.pdp', { catalog_uri: '/p/test' })
returns http://example.com/p/test
as expected. Tried on Laravel 10 and 11. Can you reproduce it in another app or a fresh install?
from ziggy.
@bakerkretzmar apologies...in my attempt to simply this for the ticket I actually removed the component that causes the issue. You're right that the scenario above works as expected.
I'm able to reproduce it with this slightly different route setup:
// catalog.php
Route::domain('{storefront}.example.com')->name('test.')->group(function () {
Route::get('{catalog_uri}', fn() => view('pdp'))
->where('catalog_uri', '^/p/.+$')
->name('pdp');
});
Calling it like this in Vue:
<pre>
test pdp: {{
route('catalog.test.pdp', {
storefront: 'me',
catalog_uri: '/p/test',
})
}}
</pre>
Yields test pdp: https://me.example.com//p/test
For context, we run a multi-tenant site with multiple storefronts, each with its own subdomain.
from ziggy.
Thanks, I can reproduce that. Will investigate!
from ziggy.
Related Issues (20)
- False negative with route().current() and nested params
- Using `route()->current('...*')` multiple time issue
- Arrow function given to Event::listen stops further propagating of the event HOT 2
- Vue Plugin isnt delivered with Composer package
- Laravel 11 support HOT 2
- Class "Tightenco\Ziggy\Ziggy" Not Found After Upgrading to Laravel 11 HOT 2
- This package does not work with Folio named routes HOT 1
- Passing Ziggy configuration to Inertia.js SSR in a Svelte app
- TypeError when optional params omitted from array
- package does not handle a Vue 2 codebase well HOT 1
- Vue: Cannot convert undefined or null to object
- Feature: Add ```route().queryParams``` to get only query params without laravel route params
- Export Helper type to get the parameters type of specific route
- Missing alert or Logic problem on current route method
- Error message : Ziggy is not defined
- Add an option for strict route checking HOT 2
- "Resolving Infinite Loop Issues in resolveBindings Function"
- Ziggy generating wrong params for resources with param url HOT 5
- Ziggy route() helper TypeError: Cannot read properties of undefined (reading 'home.index') HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ziggy.