atom feed added

This commit is contained in:
HolgerHatGarKeineNode
2023-02-15 20:51:40 +01:00
parent e764779188
commit 6b76361d55
3 changed files with 7 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
{
return self::query()
->with([
'media',
'lecturer',
])
->where('news', true)
@@ -146,13 +147,16 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
public function toFeedItem(): FeedItem
{
return FeedItem::create()
->id($this->id)
->title($this->name)
->enclosure($this->getFirstMediaUrl('main'))
->enclosureLength($this->getFirstMedia('main')->size)
->enclosureType($this->getFirstMedia('main')->mime_type)
->summary($this->excerpt)
->updated($this->updated_at)
->link(url()->route('article.view', ['libraryItem' => $this]))
->image($this->getFirstMediaUrl('main'))
->authorName($this->lecturer->name);
}
}