Hey everyone. I have a search form field within a view at a dynamic url. How do I get the search form to perform a GET query from my controller BACK to my view, while keeping the same url? Here are my routes:
// Landing Pages
Route::group(['prefix' => 'services', 'as' => 'services::'], function () {
Route::get('{category_id}', [
'as' => 'category_id',
'uses' => 'LandingController@index'
]);
Route::get('{category_id}/{subcategory_id}', [
'as' => 'subcategory_id',
'uses' => 'LandingController@businessView'
]);
Route::get('{category_id}/{subcategory_id}/{search}', [
'as' => 'search',
'uses' => 'LandingController@businessView'
]);
Route::post('{category_id}/{subcategory_id}', [
'as' => 'result',
'uses' => 'LandingController@search'
]);
});
Here is my view:
<div class="result-search">
<div class="row">
{!! Form::open(array('method' => 'get', 'route' => 'services::search', 'class' => 'form-inline')) !!}
<span class="span-in"> Change your location: </span>
<label class="sr-only" for="address">Your Location </label>
<input type="text" name="address" class="form-control" placeholder="City or Zipcode" value="{{ str_replace('\' ', '\'', ucwords(str_replace('\'', '\' ', strtolower($city)))) }}, {{ $zip }}" onclick="this.focus();this.select()">
<div aria-label="Search" role="group" class="btn-group btn-search pull-right" style>
<button class="btn btn-default" id="text" type="submit">Search</button>
<button class="btn btn-default btn-right" type="submit"><i class="icn-magni"></i></button>
</div>
{!! Form::close() !!}
</div>
</div>
Here is what I would like my site to do. If I am at this url: "http://mysite.com/services/plumbing/install" and I perform a search (lets say, with 'Atlanta'), I want the results to come up with an updated url of this: "http://mysite.com/services/plumbing/install/search?address=Atlanta". Can anyone help?