Obama
Obama

Reputation: 2612

Laravel routing system

I am working with laravel 4 and i have a problem with my routes,

for example :

//Route to display a campaign
Route::get('campaigns/{name}', 'CampaignController@show');

//Route to create a campaign
Route::get('campaigns/add', 'CampaignController@create');

The problem here is : the routing system thinks that the add in campaigns/add is a campaign name so it takes me to campaigns/{name}

How can i fix it ?

Any help would be greatly appreciated!

Upvotes: 1

Views: 210

Answers (1)

TerryMatula
TerryMatula

Reputation: 1264

Laravel matches routes from the top down. So all you need to do is put 'campaigns/add' above the wildcard route.

Upvotes: 6

Related Questions