dimanche 1 novembre 2015

Laravel routing form with method get

I'm using Laravel 5.1 and I have a problem with the routing. Currently, I have this on my routes.php

Route::get('/', 'ArticleSiteController@index');
Route::get('article/{url}', 'ArticleController@show');
Route::get('article/search/{text}', 'ArticleController@search');
Route::get('/{url}', 'PageController@index');

Routes are being redirected properly except for the search wherein it always use the ArticleController@show route.

On the homepage, I have a search form.

<form class="form-horizontal" action="http://ift.tt/1M4RmFP" method="GET">
    <input type="text" name="txtSearch" class="form-control" placeholder="Search for...">
    <span class="input-group-btn">
        <button class="btn btn-primary" type="submit">Go!</button>
    </span>
</form>

It redirects to this url: http://ift.tt/1Q3PjqK (which is correct) but uses the ArticleController@show method instead of the ArticleController@search.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Mr8Ag2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire