laravel/framework — pull request #6606 by litvinchuk (2014-12-09 11:15:02+00:00)
Title: Extending UrlGenerator with url alter method

This method basically conveniently changes parameters of the current url.

Example URL:
``` php
Route::get('/{lang}/users/profile/{id}/article/{slug}', function($lang, $id, $slug) {
// ...
});

# http://laravel/en/users/profile/12/article/super-awesome-article
```

Case 1 — single parameter:
```php
URL::alter(['lang' => 'uk'])
# http://laravel/uk/users/profile/12/article/super-awesome-article
```
Case 2 — multiple parameters:
```php
URL::alter(['lang' => 'uk', 'slug' => 'best-of-the-best-of-the-best'])
# http://laravel/uk/users/profile/12/article/best-of-the-best-of-the-best
```

Case 3 — multiple parameters with GET params:
```php
URL::alter(['lang' => 'uk', 'slug' => 'best-of-the-best-of-the-best', 'page' => 7, 'order' => 'desc'])
# http://laravel/uk/users/profile/12/article/best-of-the-best-of-the-best?page=7&order=desc
```