Hi, tell me, please, what to do when the links are the same, and I want to assign priority to routing?
e.g.
<?php
...
$router->add('/{slug:.*}', 'Pages::show')->setName('pages-show');
$router->add('/{slug:.*}', 'Categories::show')->setName('categories-show');
$router->add('/{slug:.*}', 'Brands::show')->setName('brands-show');
...
If the page is not found, then the category search, if the category is not found then the brand search. now i did so
<?php
//Controller Brands
...
public function showAction($slug) {
$page = Pages::findBySlug($slug);
if ($page) {
return $this->showPage($page);
}
$category = Categories::findBySlug($slug);
if ($category) {
return $this->showCategory($category);
}
$brand = Brands::findBySlug($slug);
if ( $brand) {
return $this->showBrand($brand);
}
if ( ! $brand) {
return $this->error404();
}
}
...
but I want to do it somehow at the step of the routes