seed introduction audio child
This commit is contained in:
parent
99fa93587a
commit
a74dd55619
1 changed files with 23 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ use App\Element\CreateElementDto;
|
||||||
use App\Element\ElementRepository;
|
use App\Element\ElementRepository;
|
||||||
use App\Set\SetRepository;
|
use App\Set\SetRepository;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
class ElementSeeder extends Seeder
|
class ElementSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|
@ -80,8 +81,9 @@ class ElementSeeder extends Seeder
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$introductionElement = null;
|
||||||
foreach ($baderechChildElements as $baderechChildElement) {
|
foreach ($baderechChildElements as $baderechChildElement) {
|
||||||
$elementRepository->create(new CreateElementDto(
|
$createdElement = $elementRepository->create(new CreateElementDto(
|
||||||
set: $baderechSet,
|
set: $baderechSet,
|
||||||
title: $baderechChildElement['title'],
|
title: $baderechChildElement['title'],
|
||||||
description: $baderechChildElement['description'],
|
description: $baderechChildElement['description'],
|
||||||
|
|
@ -91,7 +93,27 @@ class ElementSeeder extends Seeder
|
||||||
youtubeUrl: null,
|
youtubeUrl: null,
|
||||||
parentElement: $rootElement,
|
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
|
private function introductionRichText(): string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue