I'm working on my first Laravel 4 project and using the eloquent ORM to retrieve rows from the database using a route. Example:
Here is a route:
Route::get('{publisher}/{series}', function($publisher, $series)
{
$result = Comic::where('publisher', '=', $publisher)
->where('series', '=', $series)
->orderBy('issue', 'asc')
->get();
return View::make('comic')
->with('result', $result);
});
This is supposed to be matching a url like site.com/marvel/amazing-spider-man
Right now it only works for site.com/marvel/amazing spider-man or site.com/marvel/amazing%20spider-man
How can I make sure to only use the '-' urls? I believe what I need to do is:
a. write code that replaces the '-' with a %20 during the routing b. write code that replaces a %20 with a '-' during url generation
Another consideration is that I don't really want my content to be accessible on both urls.