Skip to content

Commit

Permalink
Merge pull request #231 from art-institute-of-chicago/fix/audio-titles
Browse files Browse the repository at this point in the history
Fix issue saving audio title
  • Loading branch information
zachgarwood authored Nov 8, 2023
2 parents 7a1f75a + 6bcd07b commit 79b429c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions app/Models/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public function getTitleMarkupAttribute()
return $this->getTitle();
}

public function setTitleMarkupAttribute($title)
{
return $this->attributes['title'] = $title;
}

public function apiRelation(): HasOne
{
return $this->hasOne(ApiRelation::class, 'datahub_id', 'datahub_id');
Expand Down
4 changes: 4 additions & 0 deletions app/Repositories/AudioRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public function getFormFields(TwillModelContract $audio): array

public function afterSave(TwillModelContract $audio, array $fields): void
{
if (isset($fields['title_markup'])) {
$audio->title = $fields['title_markup'];
$audio->save();
}
if (isset($fields['selector_number'])) {
$selector = Selector::firstOrCreate(['number' => $fields['selector_number']]);
$apiRelation = ApiRelation::firstOrCreate(['datahub_id' => $audio->datahub_id]);
Expand Down

0 comments on commit 79b429c

Please sign in to comment.