'int', 'published_at' => 'datetime', 'metadata' => 'object', 'keywords' => 'array', 'entities' => 'array', 'keyword_saved' => 'boolean', ]; protected $fillable = [ 'category_id', 'source', 'source_url', 'post_url', 'title', 'slug', 'body', 'keywords', 'entities', 'metadata', 'bites', 'keyword_list', 'impact', 'impact_level', 'published_at', 'status', 'keyword_saved', ]; public function entities_keywords() { return $this->hasMany(RssPostKeyword::class); } public function category() { return $this->belongsTo(Category::class); } public function getAllKeywordsAttribute() { if (! is_empty($this->keyword_list)) { return array_unique(explode(',', $this->keyword_list)); } return []; } public function toFeedItem(): FeedItem { return FeedItem::create([ 'id' => $this->id, 'title' => $this->title, 'summary' => $this->bites, 'updated' => $this->published_at, // 'link' => route('front.post', ['slug' => $this->slug, 'category_slug' => $this->category->slug]), 'authorName' => 'FutureWalker', ]); } public static function getFeedItems() { return self::with('category')->where('status', 'published')->latest('published_at')->take(60)->get(); } }