lascoff
lascoff

Reputation: 1331

Laravel create multiple parameter URL

I am trying to pass multiple parameters to the URL class in Laravel 4. I've tried the following code:

<li>  
  <a href="{{ URL::to('questions/', $chapter->id, false); }}">
    <span>Chapter {{ $chapter->chapter_num }}: {{ $chapter->name }}</span>
  </a>  
</li>

This seems to work for one parameter. How do I pass multiple parameters?

Upvotes: 1

Views: 1878

Answers (2)

Grug
Grug

Reputation: 1890

Pass the parameters in an array. For example:

array($chapter->id, $parameter2, $parameter3, false)

This may also help: http://laravel.com/api/source-class-Illuminate.Routing.UrlGenerator.html#76-98

Upvotes: 1

jnardiello
jnardiello

Reputation: 699

According to the documentation, you can pass multiple parameters as an array.

This should work: URL::to('questions/', array($chapter->id,$other->propr), false)

Hope it helps!

Upvotes: 0

Related Questions