lundi 5 juin 2017

Invalid route in a Laravel search form

Hi i'm following a tutorial bout how to set a search form but I'm getting a route error (NotFoundHttpException).

form

   {!! Form::open(['method'=>'GET' ,'url' => 'search', 'class'=>'form-group main-form', 'id'=>'search-form', 'role'=>'form']) !!}
      
      <div style="display:none"><input name="utf8" type="hidden" value="✓"></div>
      <input class="form-group main-form" id="q_objname_en_cont" name="searchKey"  placeholder='Search by Job title' required="required" style="height:40px;width:60%" type="search">
      <input class="btn btn-warning" type="submit" value="Search">
   {!! Form::close() !!}

Route

//Search route(get)
Route::get('search/{searchkey}', 'EmploiController@search')->where('searchkey', '[A-Za-z]+')->name('search');

url (browser)

http://localhost:8000/search?_token=LJpgN3AwCFoDElOkFsSOX8BBLU1IFOzMvUYiokQj&utf8=%E2%9C%93&searchKey=quia



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire