@@ -25,7 +25,6 @@ class Docs
2525 * Array of supported versions
2626 */
2727 public const SUPPORT_VERSIONS = [
28- '11.x ' ,
2928 '10.x ' ,
3029 '8.x ' ,
3130 '5.4 ' ,
@@ -373,9 +372,13 @@ public function getSections(): Collection
373372 $ sections = collect ();
374373 $ prevEnd = 0 ;
375374
375+ $ titlePage = null ;
376376 foreach ($ matches as $ index => $ match ) {
377377 $ sectionTitle = $ match [2 ];
378378
379+ if ($ match [1 ] == '1 ' ) {
380+ $ titlePage = $ sectionTitle ;
381+ }
379382 // Получаем начальную и конечную позицию текущего заголовка в тексте
380383 $ startPos = strpos ($ this ->content (), $ match [0 ], $ prevEnd );
381384
@@ -389,12 +392,13 @@ public function getSections(): Collection
389392 }
390393
391394 $ sections ->push ([
392- 'title ' => $ sectionTitle ,
393- 'slug ' => Str::of ($ sectionTitle )->slug ()->toString (),
394- 'content ' => $ sectionContent ,
395- 'file ' => $ this ->file ,
396- 'version ' => $ this ->version ,
397- 'id ' => Str::uuid (),
395+ 'title_page ' => $ titlePage ,
396+ 'title ' => $ sectionTitle ,
397+ 'slug ' => Str::of ($ sectionTitle )->slug ()->toString (),
398+ 'content ' => $ sectionContent ,
399+ 'file ' => $ this ->file ,
400+ 'version ' => $ this ->version ,
401+ 'id ' => Str::uuid (),
398402 ]);
399403 }
400404
@@ -403,7 +407,7 @@ public function getSections(): Collection
403407
404408 public function updateSections ()
405409 {
406- // DocumentationSection::where('file', $this->file)->where('version', $this->version)->delete();
407- // DocumentationSection::insert($this->getSections()->toArray());
410+ DocumentationSection::where ('file ' , $ this ->file )->where ('version ' , $ this ->version )->delete ();
411+ DocumentationSection::insert ($ this ->getSections ()->toArray ());
408412 }
409413}
0 commit comments