refactor sitemap generation and navigation handling; remove old GenerateSitemap command, update to use tasks for better organization, and enhance navigation data retrieval
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\AppStructure\Tasks;
|
||||
|
||||
class GetIndexRouteNameTask
|
||||
{
|
||||
public function run(string $routeName = null): ?string
|
||||
{
|
||||
if ($routeName === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$parts = explode('.', $routeName);
|
||||
|
||||
// Если в маршруте нет точек или он уже заканчивается на index
|
||||
if (count($parts) <= 1 || end($parts) === 'index') {
|
||||
return $routeName;
|
||||
}
|
||||
|
||||
// Заменяем последнюю часть на index
|
||||
$parts[count($parts) - 1] = 'index';
|
||||
|
||||
return implode('.', $parts);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user