calc = $calc; $this->ranker = $ranker; } public function __invoke(Request $request, Audition $audition) { $entryData = []; #$entries = Entry::forSeating()->with('student.school')->where('audition_id', $audition->id)->get(); $entries = $this->ranker->rank('seating', $audition); $entries->load('student.school'); foreach ($entries as $entry) { $totalScoreColumn = $entry->score_totals[0] >= 0 ? $entry->score_totals[0] : $entry->score_message; $entryData[] = [ 'rank' => $entry->rank, 'id' => $entry->id, 'studentName' => $entry->student->full_name(), 'schoolName' => $entry->student->school->name, 'drawNumber' => $entry->draw_number, 'totalScore' => $totalScoreColumn, 'fullyScored' => $entry->score_totals[0] >= 0, ]; } //dd($entryData); return view('tabulation.auditionSeating', ['entryData' => $entryData, 'audition' => $audition]); } }