seed introduction audio child

This commit is contained in:
Yisroel Baum 2026-05-27 22:08:24 +03:00
parent 99fa93587a
commit a74dd55619
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -6,6 +6,7 @@ use App\Element\CreateElementDto;
use App\Element\ElementRepository;
use App\Set\SetRepository;
use Illuminate\Database\Seeder;
use RuntimeException;
class ElementSeeder extends Seeder
{
@ -80,8 +81,9 @@ class ElementSeeder extends Seeder
],
];
$introductionElement = null;
foreach ($baderechChildElements as $baderechChildElement) {
$elementRepository->create(new CreateElementDto(
$createdElement = $elementRepository->create(new CreateElementDto(
set: $baderechSet,
title: $baderechChildElement['title'],
description: $baderechChildElement['description'],
@ -91,7 +93,27 @@ class ElementSeeder extends Seeder
youtubeUrl: null,
parentElement: $rootElement,
));
if ($baderechChildElement['title'] === '1. Introduction') {
$introductionElement = $createdElement;
}
}
if ($introductionElement === null) {
throw new RuntimeException('Introduction element was not seeded');
}
$elementRepository->create(new CreateElementDto(
set: $baderechSet,
title: 'Fundamentals # 1: Living Our Way to a Wholesome '
. 'Fulfilled Life (Audio)',
description: '',
iconImageUrl: null,
richText: '',
pdfPath: null,
youtubeUrl: 'https://www.youtube.com/watch?v='
. 'yHx-r4p6hHU&t=1s',
parentElement: $introductionElement,
));
}
private function introductionRichText(): string