Skip to content

Instantly share code, notes, and snippets.

@rafa-acioly
Last active July 11, 2016 16:46
Show Gist options
  • Save rafa-acioly/02acdba3bfa6fbff84403ffcc2219b71 to your computer and use it in GitHub Desktop.
Save rafa-acioly/02acdba3bfa6fbff84403ffcc2219b71 to your computer and use it in GitHub Desktop.
use App\Content; // Model responsavel pelo gerenciamento de conteudo (datas)
private $content;
public function __construct(Content $content) {
$this->content = $content;
}
public function feed()
{
$contents = $this->content->all(); // Busca todos os dados.
$feed = array();
foreach ($contents as $content) {
$feed[] = [
‘id’ => $content->id,
‘title’ => $content->title,
‘start’ => $content->scheduled_to,
‘end’ => $content->scheduled_to,
‘color’ => “gray”
];
}
return response()->json($feed);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment