Laravel interpreting a string in route as parameter

I tried googling, but I can't phrase the question right, it is simple.

I have these 2 routes:

Route::get('admin_firme/{id_firma}/filijale/{id_filijala}', 'FilijalaAdminController@show'); 
Route::get('admin_firme/{id_firma}/filijale/create', 'FilijalaAdminController@create')

They call different controller actions. The problem is in the second route which calls the create method. The part /filijale/create is being interpreted as the parameter of the first route, thus calling the wrong method. How can I correct this?

I tried naming the route and generating an url to it, but it still calls the wrong method.


There's two things you can do. The first, and easiest, is to swap the order of them round so when checking matching routes it checks to see if it's create first, and if not anything else matches id_filijala.

The second thing you can do is use pattern matching for id_filijala, for example if it only contained numbers then you could use:

Route::get('admin_firme/{id_firma}/filijale/{id_filijala}', 'FilijalaAdminController@show')
    ->where('id_filijala', '[0-9]+');

You can use any regular expression in the where.

Just take the bottom one up ...

Route::get('admin_firme/{id_firma}/filijale/create', 'FilijalaAdminController@create');
Route::get('admin_firme/{id_firma}/filijale/{id_filijala}', 'FilijalaAdminController@show'); 

should work.

Need Your Help

wordpress csv file help on bluk improts

php mysql wordpress csv

I am new to here so please bare with me trying to explain my problem.

Numeric range with regular expression

regex range

I need a regular expression to find a number in the range [40010-40100]. I tried with this 40[0-1][0-9][0-9] but it doesn't work. Could someone help me?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.