This commit is contained in:
F4ilji
2026-04-07 17:54:26 +05:00
parent 04adba6682
commit 936b1fb5b0
468 changed files with 43498 additions and 4176 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Containers\Dashboard\Actions\Pages;
use App\Containers\AppStructure\Models\SubSection;
class GeneratePagePathAction
{
public function run(string $slug, ?int $subSectionId = null): string
{
if ($subSectionId === null) {
return $slug;
}
$subSection = SubSection::with('mainSection')->find($subSectionId);
if ($subSection === null) {
return $slug;
}
if ($subSection->mainSection === null) {
return $subSection->slug . '/' . $slug;
}
return $subSection->mainSection->slug . '/' . $subSection->slug . '/' . $slug;
}
}