fix category page
This commit is contained in:
parent
a1d945a8ab
commit
7f661597ba
4 changed files with 11 additions and 7 deletions
|
|
@ -11,13 +11,17 @@ return [
|
|||
fn($text) => Str::slug($text->category()) === $category
|
||||
);
|
||||
|
||||
$children = new Pages();
|
||||
$texts = [];
|
||||
|
||||
foreach ($textsInCategory as $text) {
|
||||
$children->add($text);
|
||||
$texts[] = (string) $text->uri();
|
||||
}
|
||||
|
||||
$title = $textsInCategory->first()->category();
|
||||
try {
|
||||
$title = $textsInCategory->first()->category();
|
||||
} catch (\Throwable $th) {
|
||||
go('/erreur');
|
||||
}
|
||||
|
||||
return Page::factory([
|
||||
'slug' => Str::slug($category) . '-' . Uuid::generate(),
|
||||
|
|
@ -25,9 +29,9 @@ return [
|
|||
'model' => 'category',
|
||||
'content' => [
|
||||
'title' => $title,
|
||||
'texts' => Yaml::encode($texts),
|
||||
'uuid' => Uuid::generate(),
|
||||
],
|
||||
'children' => $children->toArray(),
|
||||
]);
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue