laravel/framework — pull request #6612 by litvinchuk (2014-12-09 22:52:40+00:00)
Title: [5.0] 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?page=12
```

Case 1 — single parameter:
```php
URL::alter(['lang' => 'uk'])
# http://laravel/uk/users/profile/12/article/super-awesome-article?page=12
```
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?page=12
```

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
```