Reputation: 371
I have a named route
Route::get('login/facebook', array(
'as' > 'login.facebook.authorise',
'uses' => 'AuthController@getFBAuthorise'
));
and want to produce a URL pointing to it with a query string appended.
For example:
URL::route('login.facebook.authorise', array("next"=>'/dashboard/')
would produce
/login/facebook?next=/dashboard/
Is something like this built in to the framework? If not, what is the best way to try and do this?
Thanks.
Upvotes: 2
Views: 5144
Reputation: 78
I am a bit late to the party
Just dove into the classes and methods for building urls and you can do this:
link_to_route('login.facebook.authorise','Facebook Login',array('next'=>'/Dashboard/'))
So. the array will always fallback to query params unless the names are declared in the route.
Upvotes: 1
Reputation: 8682
The URL helper can do this.
http://laravel.com/docs/helpers#urls
echo link_to_route('route.name', $title, $parameters = array(), $attributes = array());
EDIT: To get only the URL :
http://laravel.com/docs/routing#named-routes
$url = URL::route('route.name', $parameters);
Upvotes: 1
Reputation: 451
If the use case for this is redirecting to a page after logging in then you could use
Redirect::intended('dashboard');
As seen here http://laravel.com/docs/security#authenticating-users
Sorry if that's not what you're trying to achieve.
Upvotes: 0