@@ -169,6 +169,7 @@ class LivewireComponentExample extends Component
169
169
| ** Methods** | Description | Parameters |
170
170
| -----------------------------------| ------------------------------------------------------------- | -------------------- |
171
171
| generateUrl() | Generate manually the URL | |
172
+ | getSlug() | Get the URL for a specific language in relative or absolute format | ?string $language = '', bool $relative = true |
172
173
| urlStrategy | The strategy for creating the URL for the model | $language, $locale |
173
174
| isAutoGenerateUrls() | Disable generating urls on creation, globally for the model | |
174
175
| disableGeneratingUrlsOnCreate() | Disable generating urls on creation | |
@@ -178,6 +179,25 @@ class LivewireComponentExample extends Component
178
179
| ** Relations** | | |
179
180
| urls() | All the active urls, related to the current model | |
180
181
182
+ ### Getting Model URLs
183
+
184
+ ``` php
185
+ // Get relative URL for current locale
186
+ $model->relative_url; // e.g., "my-product-name"
187
+
188
+ // Get absolute URL for current locale
189
+ $model->absolute_url; // e.g., "https://example.com/my-product-name"
190
+
191
+ // Get URL for specific language (relative)
192
+ $model->getSlug('en', true); // e.g., "my-product-name"
193
+
194
+ // Get URL for specific language (absolute)
195
+ $model->getSlug('en', false); // e.g., "https://example.com/my-product-name"
196
+
197
+ // Get URL for current locale (defaults to app locale)
198
+ $model->getSlug(); // e.g., "my-product-name"
199
+ ```
200
+
181
201
## Commands
182
202
### urls: generate
183
203
This command generates unique URLs for the specified model or all models in the application that implement the ` HasUniqueUrls ` trait.
0 commit comments