Skip to content

Instantly share code, notes, and snippets.

@itsrachelfish
Created October 31, 2018 21:08
Show Gist options
  • Save itsrachelfish/61d8848665196516559a6c0d99c96c55 to your computer and use it in GitHub Desktop.
Save itsrachelfish/61d8848665196516559a6c0d99c96c55 to your computer and use it in GitHub Desktop.
Art grants exportable updates
<?php
$columns = [];
$data = [];
foreach($exportableQuestions as $question)
{
$columns['question_' . $question->id] = $question->question;
}
<?php
foreach($round->applications as $application)
{
$row = [];
foreach($exportableQuestions as $question)
{
$row['question_' . $question->id] = $application->answers()->where('question_id', $question->id)->value('answer');
}
$data[] = $row;
}
<?php
$exportableQuestions = $round->questions()->where('exportable', true)->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment