Пример #1
0
 /**
  * Create a new feed controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->feed = app('feed');
     $this->feed->title = Config::get('setting.app_name');
     $this->feed->description = trans('cachet.feed');
     $this->feed->link = Str::canonicalize(Config::get('setting.app_domain'));
     $this->feed->ctype = 'text/xml';
     $this->feed->setDateFormat('datetime');
 }
 private function fillFeed(Feed $feed)
 {
     $posts = app(ContentRepository::class)->posts();
     $feed->title = 'Sebastian De Deyne';
     $feed->description = 'Full-stack developer working at Spatie in Antwerp, Belgium';
     $feed->link = request()->url();
     $feed->setDateFormat('datetime');
     $feed->pubdate = $posts->first() ? $posts->first()->date : Carbon::now();
     $feed->lang = 'en';
     $feed->setShortening(false);
     $posts->each(function (Article $post) use($feed) {
         $feed->add($post->title, 'Sebastian De Deyne', $post->url, $post->date, string($post->contents)->tease(140), $post->contents);
     });
 }