Answer
That's easily done through routing. So in your route file it will be something like this...
Route::get('music/{slug}', ['as' => 'music', 'uses' => 'music\MusicController@music']);
Then anything that comes in to your domain as https://yourdomain.com/music/slug will go to that music controller and you can process what slug is, then grab the model stuff you need and shoot them to a view.
If you really want nothing but short urls meaning https://yourdomain.com/shorturl you'll have to put the wild card at the root. This could have some undesired effects though if you don't have your routes set up in order. I'd probably put some middleware on the group too to process the shortUrl code and then send it on through to the controller where you can handle bringing back the model and shooting them to a view.
0 comments:
Post a Comment
Thanks