@foreach(Character::activeCharacters()->orderBy('name')->get() as $c) <?php //Find the relevant thread $topic = ForumPost::where('body', "[[questionnaire/{$c->id}]]")->first(); ?> <tr> <td> @if($topic) <a href="/forums/topic/{{$topic->topic->id}}">{{$c->name}}</a> @else {{$c->name}} @endif </td> <?php $biographies = CharacterQuestionnaire::where('character_id', $c->id)->where('response', '!=', '')->get(); $experience = CharacterBiographyExperience::where('character_id', $c->id)->first(); ?> <td> {{$biographies->count()}} </td> <td> @if($c->backstory_file) <a href="/content/backstories/{{$c->backstory_file}}"> <i class="icon-book"></i> </a> @endif </td> <td> @if($experience && $experience->questionnaire_xp) <i class='icon-check'></i> @else