Skip to content

Instantly share code, notes, and snippets.

@nobodyplace
Last active July 29, 2019 03:56
Show Gist options
  • Select an option

  • Save nobodyplace/6e410e158a362ed9a1dc249c5314740e to your computer and use it in GitHub Desktop.

Select an option

Save nobodyplace/6e410e158a362ed9a1dc249c5314740e to your computer and use it in GitHub Desktop.
<?php
$posts = array();
array_push($posts,(object) [
'title' => $entry->title
,'author' => $entry->author
,'permalink' => $entry->url
,'created' => new Carbon('2019-07-29 12:24:51')
,'description' => $entry->description
,'content' => $entry->content
]);
$feed = App::make('feed');
$feed->setDateFormat('carbon');
$feed->pubdate = $posts[0]->created;
foreach ($posts as $post) {
$feed->add(
$post->title
,$post->author
,$post->permalink
,$feed->formatDate($post->created,$feed->getDateFormat()) // Mon, 29 Jul 2019 12:24:51 +0900 と出力される
,$post->description
,$post->content
);
}
return $feed->render('rss');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment