I have some code in a controller called SearchController and I redirect to a route with some variables that were defined. The city variable has the spaces removed and a dash added for when the city has two words(ex:Des Moines). That would return "des-moines". I did this because in the URL it was showing up as "des+monies". But after changing that. The route does seem to know what to do or it breaks. So how can I tell the route that the {city} can also be things like "des-moines" instead of having "des+moines". Or is there a better way of doing this.
Url I want(but breaks and gets error):
http://ift.tt/1mBk6A4
SearchController(cut down version):
$city = strtolower(preg_replace('/\s+/', '-', $data[0]->City));
$state = strtolower($data[0]->State);
$provider = strtolower($data[0]->{'Provider Name'});
$zipcode = $data[0]->{'Zip Code'};
return redirect()->route('search.provider1',[$city,$state,$zipcode])->with('data',$data);
Routes:
Route::get('{city}-{state}-provider1-{zipcode}',['uses' => 'PagesController@provider1','as' => 'search.provider1']);
Error:
NotFoundHttpException in RouteCollection.php line 161:
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1PIS416
via IFTTT
Aucun commentaire:
Enregistrer un commentaire