I have an issue dynamically accessing an array in one of my views.
I begin by organizing the values I need easy access to into $entityClubStats like this:
$entityClubStats = [];
foreach($entity->clubs as $club) {
$entityClubStats[$club->name] = [
'days_to_pay' => $club->pivot->days_to_pay,
// ...
];
}
Then I iterate the master list of clubs with the intent of filling in relevant values if they exist:
@foreach (Club::isIncludedInStats()->get() as $club)
<div>
<label>Name</label>
<input type="text" value="{{$club->name}}" readonly />
</div>
<div>
<label>Days to Pay</label>
<input type="text" name="club_days_to_pay" value="{{$entityClubStats[$club->name]['days_to_pay']}}" />
</div>
<!-- ... -->
@endforeach
The problem is that while I've tried using {{double_brackets}} and <?= standard_syntax ?>, this segment results in a white screen:
$entityClubStats[$club->name]['days_to_pay'];
However, it does work when I simply hardcode the $club->name:
$entityClubStats['AAA']['days_to_pay'];
Why?