Answer the question
In order to leave comments, you need to log in
Dynamic address in Laravel 4?
Good evening. I am building an online store with Laravel. Implemented categories using nested sets (thanks to Sergey Gladkovsky ). Now there is a need to display products in categories. The categories table has a url field (transliterates names, for example, telephoni). For example, we have a directory with the following structure:
/catalog/
computers/
accessories/
motherboards/
video-cards/
phones/
smartphones/
babushkofoni/
accessories/
Answer the question
In order to leave comments, you need to log in
Try it
and in the controller:
Route::get('{catalog}/{otherLinks?}', '[email protected]')->where('otherLinks', '(.*)');
class MainController extends BaseController {
public function getPage($pageLink, $otherLinks = null)
{
if($otherLinks)
{
$otherLinks = explode('/', $otherLinks);
// твой код
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question