add element youtube url
This commit is contained in:
parent
f9c4d72e60
commit
ff58f23bb7
10 changed files with 27 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ class ElementController
|
||||||
'description' => $element->getDescription(),
|
'description' => $element->getDescription(),
|
||||||
'richText' => $element->getRichText(),
|
'richText' => $element->getRichText(),
|
||||||
'pdfPath' => $element->getPdfPath(),
|
'pdfPath' => $element->getPdfPath(),
|
||||||
|
'youtubeUrl' => $element->getYoutubeUrl(),
|
||||||
],
|
],
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class CreateElementDto
|
||||||
public string $description,
|
public string $description,
|
||||||
public string $richText,
|
public string $richText,
|
||||||
public ?string $pdfPath,
|
public ?string $pdfPath,
|
||||||
|
public ?string $youtubeUrl,
|
||||||
public ?Element $parentElement,
|
public ?Element $parentElement,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class Element
|
||||||
private string $description,
|
private string $description,
|
||||||
private string $richText,
|
private string $richText,
|
||||||
private ?string $pdfPath,
|
private ?string $pdfPath,
|
||||||
|
private ?string $youtubeUrl,
|
||||||
private Set $set,
|
private Set $set,
|
||||||
private ?Element $parentElement,
|
private ?Element $parentElement,
|
||||||
) {
|
) {
|
||||||
|
|
@ -42,6 +43,11 @@ class Element
|
||||||
return $this->pdfPath;
|
return $this->pdfPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getYoutubeUrl(): ?string
|
||||||
|
{
|
||||||
|
return $this->youtubeUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public function getSet(): Set
|
public function getSet(): Set
|
||||||
{
|
{
|
||||||
return $this->set;
|
return $this->set;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property string $rich_text
|
* @property string $rich_text
|
||||||
* @property string|null $pdf_path
|
* @property string|null $pdf_path
|
||||||
|
* @property string|null $youtube_url
|
||||||
* @property int|null $parent_element_id
|
* @property int|null $parent_element_id
|
||||||
*
|
*
|
||||||
* @method static Builder<static>|ElementModel newModelQuery()
|
* @method static Builder<static>|ElementModel newModelQuery()
|
||||||
|
|
@ -24,6 +25,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @method static Builder<static>|ElementModel whereDescription($value)
|
* @method static Builder<static>|ElementModel whereDescription($value)
|
||||||
* @method static Builder<static>|ElementModel whereRichText($value)
|
* @method static Builder<static>|ElementModel whereRichText($value)
|
||||||
* @method static Builder<static>|ElementModel wherePdfPath($value)
|
* @method static Builder<static>|ElementModel wherePdfPath($value)
|
||||||
|
* @method static Builder<static>|ElementModel whereYoutubeUrl($value)
|
||||||
*
|
*
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
*/
|
*/
|
||||||
|
|
@ -39,6 +41,7 @@ class ElementModel extends Model
|
||||||
'description',
|
'description',
|
||||||
'rich_text',
|
'rich_text',
|
||||||
'pdf_path',
|
'pdf_path',
|
||||||
|
'youtube_url',
|
||||||
'parent_element_id',
|
'parent_element_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class EloquentElementRepository implements ElementRepository
|
||||||
'description' => $dto->description,
|
'description' => $dto->description,
|
||||||
'rich_text' => $dto->richText,
|
'rich_text' => $dto->richText,
|
||||||
'pdf_path' => $dto->pdfPath,
|
'pdf_path' => $dto->pdfPath,
|
||||||
|
'youtube_url' => $dto->youtubeUrl,
|
||||||
'parent_element_id' => $dto->parentElement?->getId(),
|
'parent_element_id' => $dto->parentElement?->getId(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -29,6 +30,7 @@ class EloquentElementRepository implements ElementRepository
|
||||||
description: $dto->description,
|
description: $dto->description,
|
||||||
richText: $dto->richText,
|
richText: $dto->richText,
|
||||||
pdfPath: $dto->pdfPath,
|
pdfPath: $dto->pdfPath,
|
||||||
|
youtubeUrl: $dto->youtubeUrl,
|
||||||
set: $dto->set,
|
set: $dto->set,
|
||||||
parentElement: $dto->parentElement,
|
parentElement: $dto->parentElement,
|
||||||
);
|
);
|
||||||
|
|
@ -111,6 +113,7 @@ class EloquentElementRepository implements ElementRepository
|
||||||
description: $model->description,
|
description: $model->description,
|
||||||
richText: $model->rich_text,
|
richText: $model->rich_text,
|
||||||
pdfPath: $model->pdf_path,
|
pdfPath: $model->pdf_path,
|
||||||
|
youtubeUrl: $model->youtube_url,
|
||||||
set: $set,
|
set: $set,
|
||||||
parentElement: $parentElement,
|
parentElement: $parentElement,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ class CreateElement
|
||||||
$description = $request->description ?? '';
|
$description = $request->description ?? '';
|
||||||
$richText = $request->richText ?? '';
|
$richText = $request->richText ?? '';
|
||||||
$pdfPath = $request->pdfPath === '' ? null : $request->pdfPath;
|
$pdfPath = $request->pdfPath === '' ? null : $request->pdfPath;
|
||||||
|
$youtubeUrl = $request->youtubeUrl === ''
|
||||||
|
? null
|
||||||
|
: $request->youtubeUrl;
|
||||||
|
|
||||||
$set = $this->setRepo->find($request->setId);
|
$set = $this->setRepo->find($request->setId);
|
||||||
if ($set === null) {
|
if ($set === null) {
|
||||||
|
|
@ -50,6 +53,7 @@ class CreateElement
|
||||||
description: $description,
|
description: $description,
|
||||||
richText: $richText,
|
richText: $richText,
|
||||||
pdfPath: $pdfPath,
|
pdfPath: $pdfPath,
|
||||||
|
youtubeUrl: $youtubeUrl,
|
||||||
parentElement: null,
|
parentElement: null,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +78,7 @@ class CreateElement
|
||||||
description: $description,
|
description: $description,
|
||||||
richText: $richText,
|
richText: $richText,
|
||||||
pdfPath: $pdfPath,
|
pdfPath: $pdfPath,
|
||||||
|
youtubeUrl: $youtubeUrl,
|
||||||
parentElement: $parentElement,
|
parentElement: $parentElement,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class CreateElementRequest
|
||||||
public ?string $description,
|
public ?string $description,
|
||||||
public ?string $richText,
|
public ?string $richText,
|
||||||
public ?string $pdfPath,
|
public ?string $pdfPath,
|
||||||
|
public ?string $youtubeUrl,
|
||||||
public ?int $parentElementId,
|
public ?int $parentElementId,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ return new class extends Migration
|
||||||
$table->text('description')->default('');
|
$table->text('description')->default('');
|
||||||
$table->text('rich_text')->default('');
|
$table->text('rich_text')->default('');
|
||||||
$table->string('pdf_path')->nullable();
|
$table->string('pdf_path')->nullable();
|
||||||
|
$table->string('youtube_url')->nullable();
|
||||||
$table->foreignId('parent_element_id')
|
$table->foreignId('parent_element_id')
|
||||||
->nullable()
|
->nullable()
|
||||||
->constrained('elements');
|
->constrained('elements');
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ class ElementSeeder extends Seeder
|
||||||
. '<p><strong>Move steadily</strong> from awareness '
|
. '<p><strong>Move steadily</strong> from awareness '
|
||||||
. 'to practice.</p>',
|
. 'to practice.</p>',
|
||||||
pdfPath: '/assets/pdfs/baderech.pdf',
|
pdfPath: '/assets/pdfs/baderech.pdf',
|
||||||
|
youtubeUrl: 'https://www.youtube.com/watch?v='
|
||||||
|
. 'yHx-r4p6hHU&t=1s',
|
||||||
parentElement: null,
|
parentElement: null,
|
||||||
));
|
));
|
||||||
$elementRepository->create(new CreateElementDto(
|
$elementRepository->create(new CreateElementDto(
|
||||||
|
|
@ -32,6 +34,7 @@ class ElementSeeder extends Seeder
|
||||||
richText: '<p>Avodah foundations begin with honest awareness '
|
richText: '<p>Avodah foundations begin with honest awareness '
|
||||||
. 'and small repeatable steps.</p>',
|
. 'and small repeatable steps.</p>',
|
||||||
pdfPath: null,
|
pdfPath: null,
|
||||||
|
youtubeUrl: null,
|
||||||
parentElement: $rootElement,
|
parentElement: $rootElement,
|
||||||
));
|
));
|
||||||
$elementRepository->create(new CreateElementDto(
|
$elementRepository->create(new CreateElementDto(
|
||||||
|
|
@ -41,6 +44,7 @@ class ElementSeeder extends Seeder
|
||||||
richText: '<p>Daily practice turns inspiration into a '
|
richText: '<p>Daily practice turns inspiration into a '
|
||||||
. 'dependable rhythm.</p>',
|
. 'dependable rhythm.</p>',
|
||||||
pdfPath: null,
|
pdfPath: null,
|
||||||
|
youtubeUrl: null,
|
||||||
parentElement: $rootElement,
|
parentElement: $rootElement,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class FakeElementRepository implements ElementRepository
|
||||||
description: $dto->description,
|
description: $dto->description,
|
||||||
richText: $dto->richText,
|
richText: $dto->richText,
|
||||||
pdfPath: $dto->pdfPath,
|
pdfPath: $dto->pdfPath,
|
||||||
|
youtubeUrl: $dto->youtubeUrl,
|
||||||
set: $dto->set,
|
set: $dto->set,
|
||||||
parentElement: $dto->parentElement,
|
parentElement: $dto->parentElement,
|
||||||
);
|
);
|
||||||
|
|
@ -101,6 +102,7 @@ class FakeElementRepository implements ElementRepository
|
||||||
description: $element->getDescription(),
|
description: $element->getDescription(),
|
||||||
richText: $element->getRichText(),
|
richText: $element->getRichText(),
|
||||||
pdfPath: $element->getPdfPath(),
|
pdfPath: $element->getPdfPath(),
|
||||||
|
youtubeUrl: $element->getYoutubeUrl(),
|
||||||
set: $element->getSet(),
|
set: $element->getSet(),
|
||||||
parentElement: $parentElement,
|
parentElement: $parentElement,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue