Skip to content

Commit d18bdad

Browse files
committed
Update README.md
1 parent 415073e commit d18bdad

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Optionally remove the locale slug from the URL for your main language.
1717
- [Generate localized route URL's](#generate-route-urls) in the simplest way using the `route()` helper.
1818
- [Redirect to localized routes](#redirect-to-routes) using the `redirect()->route()` helper.
19+
- Generate localized signed route URL's
1920
- Allow routes to be [cached](#cache-routes).
2021
- Optionally [translate each segment](#translate-routes) in your URI's.
2122
- **Let you work with routes without thinking too much about locales.**
@@ -132,13 +133,17 @@ If you set `omit_url_prefix_for_locale` to `'en'` in the configuration file, the
132133

133134
You can get the URL of your named routes as usual, using the `route()` helper.
134135

136+
##### 👎 The ugly way...
137+
135138
Normally you would have to include the locale whenever you want to generate a URL:
136139

137140
```php
138141
$url = route(app()->getLocale().'.admin.reports.index');
139142
```
140143

141-
Because that's rather ugly, this package overwrites the `route()` function and the underlying `UrlGenerator` class with an additional, optional `$locale` argument and takes care of the locale prefix for you. If you don't specify a locale, either a normal, non-localized route or a route in the current locale is returned.
144+
##### 👍 A much nicer way...
145+
146+
Because the former is rather ugly, this package overwrites the `route()` function and the underlying `UrlGenerator` class with an additional, optional `$locale` argument and takes care of the locale prefix for you. If you don't specify a locale, either a normal, non-localized route or a route in the current locale is returned.
142147

143148
```php
144149
route($name, $parameters = [], $absolute = true, $locale = null)
@@ -180,6 +185,24 @@ You can't redirect to URL's in a specific locale this way, but if you need to, y
180185
return redirect(route('about', [], true, 'nl')); // redirects to /nl/about
181186
```
182187

188+
### ✍🏻 Generate Signed Route URL's
189+
190+
Generating a [signed route URL](https://laravel.com/docs/5.8/urls#signed-urls) is just as easy.
191+
192+
Pass it the route name, the nescessary parameters and you will get the URL for the current locale.
193+
194+
```php
195+
$signedUrl = URL::signedRoute('reset.password', ['user' => $id], now()->addMinutes(30));
196+
```
197+
198+
You can also generate a signed URL for a specific locale:
199+
200+
```php
201+
$signedUrl = URL::signedRoute($name, $parameters, $expiration, true, 'nl');
202+
```
203+
204+
Check out the [Laravel docs](https://laravel.com/docs/5.8/urls#signed-urls) for more info on signed routes.
205+
183206
### 🌎 Translate Routes
184207

185208
If you want to translate the segments of your URI's, create a `routes.php` language file for each locale you [configured](#configure-supported-locales):
@@ -285,11 +308,16 @@ php artisan route:cache
285308
composer test
286309
```
287310

288-
## 🔐 Security
311+
## ☕️ Credits
312+
313+
- [Ivan Vermeyen](https://byterider.io)
314+
- [All contributors](../../contributors)
315+
316+
## 🔓 Security
289317

290318
If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.
291319

292-
## 📖 Changelog
320+
## 📑 Changelog
293321

294322
See a list of important changes in the [changelog](CHANGELOG.md).
295323

0 commit comments

Comments
 (0)