laravel/framework — pull request #1769 by alexandre-butynski (2013-06-28 14:23:58+00:00)
Title: Make URL::to() enough flexible to be simpler and more readable by accepting object as path

When we use resource controllers, we call a lot of time the same URLs like `http://www.example.com/user/3`. In fact we want to go to a model page not a route, we want to see the HTML representation of a user object, so it seems to me natural to get an URL directly from an object. If the [conventions](http://laravel.com/docs/controllers#resource-controllers) are respected it's an easy implementation.

My goal is to switch form this quite ugly syntax :

```php
URL::to('user/'.$user->id);
URL::to('user/'.$user->id.'/edit');

URL::to('user', array($user->id));
URL::to('user', array($user->id, 'edit'));
```

To this simpler and more readable one :

```php
URL::to($user);
URL::to($user, array('edit'));
```

Of course, the previous behavior is maintained because it is useful in many cases.

Any comment about the idea or the implementation is welcome :)