mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
if link
This commit is contained in:
@@ -33,41 +33,43 @@ class Episode extends Resource
|
|||||||
public static function afterUpdate(NovaRequest $request, Model $model)
|
public static function afterUpdate(NovaRequest $request, Model $model)
|
||||||
{
|
{
|
||||||
if ($request->tags) {
|
if ($request->tags) {
|
||||||
$lecturer = \App\Models\Lecturer::updateOrCreate(['name' => $model->podcast->title], [
|
if ($model->data['link']) {
|
||||||
'team_id' => 1,
|
$lecturer = \App\Models\Lecturer::updateOrCreate(['name' => $model->podcast->title], [
|
||||||
'active' => true,
|
'team_id' => 1,
|
||||||
'website' => $model->podcast->link,
|
'active' => true,
|
||||||
]);
|
'website' => $model->podcast->link,
|
||||||
if ($model->podcast->data['image']) {
|
|
||||||
$lecturer->addMediaFromUrl($model->podcast->data['image'])
|
|
||||||
->toMediaCollection('avatar');
|
|
||||||
}
|
|
||||||
$library = \App\Models\Library::firstOrCreate(
|
|
||||||
[
|
|
||||||
'name' => 'Podcasts'
|
|
||||||
]);
|
]);
|
||||||
$libraryItem = $model->libraryItem()
|
if ($model->podcast->data['image']) {
|
||||||
->firstOrCreate([
|
$lecturer->addMediaFromUrl($model->podcast->data['image'])
|
||||||
'lecturer_id' => $lecturer->id,
|
->toMediaCollection('avatar');
|
||||||
'episode_id' => $model->id,
|
}
|
||||||
'name' => $model->data['title'],
|
$library = \App\Models\Library::firstOrCreate(
|
||||||
'type' => 'podcast_episode',
|
[
|
||||||
'language_code' => $model->podcast->language_code,
|
'name' => 'Podcasts'
|
||||||
'value' => null,
|
]);
|
||||||
'excerpt' => $model->data['description'],
|
$libraryItem = $model->libraryItem()
|
||||||
'subtitle' => $model->data['description'],
|
->firstOrCreate([
|
||||||
]);
|
'lecturer_id' => $lecturer->id,
|
||||||
$libraryItem->syncTagsWithType(is_array($request->tags) ? $request->tags : str($request->tags)->explode('-----'),
|
'episode_id' => $model->id,
|
||||||
'library_item');
|
'name' => $model->data['title'],
|
||||||
if ($model->data['image']) {
|
'type' => 'podcast_episode',
|
||||||
$libraryItem->addMediaFromUrl($model->data['image'])
|
'language_code' => $model->podcast->language_code,
|
||||||
->toMediaCollection('main');
|
'value' => null,
|
||||||
} else {
|
'excerpt' => $model->data['description'],
|
||||||
$libraryItem->addMediaFromUrl($model->podcast->data['image'])
|
'subtitle' => $model->data['description'],
|
||||||
->toMediaCollection('main');
|
]);
|
||||||
|
$libraryItem->syncTagsWithType(is_array($request->tags) ? $request->tags : str($request->tags)->explode('-----'),
|
||||||
|
'library_item');
|
||||||
|
if ($model->data['image']) {
|
||||||
|
$libraryItem->addMediaFromUrl($model->data['image'])
|
||||||
|
->toMediaCollection('main');
|
||||||
|
} else {
|
||||||
|
$libraryItem->addMediaFromUrl($model->podcast->data['image'])
|
||||||
|
->toMediaCollection('main');
|
||||||
|
}
|
||||||
|
$library->libraryItems()
|
||||||
|
->attach($libraryItem);
|
||||||
}
|
}
|
||||||
$library->libraryItems()
|
|
||||||
->attach($libraryItem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user