Can you provide a sample code in which we can tweak?
Thanks for the help
@foreach($place->attested[$counter] as $attestation)
//so attestation at this point should be an array
//however it comes out as strings
@endforeach
It is from the $place Model which when debugged looks like this https://www.dropbox.com/s/uelptxl707thd8t/Screen%20Shot%202014-02-25%20at%2012.36.59.png
What is $counter? Isn't it just @foreach($place->attested as $attestation)
?
Can you var_dump your $place->attested[$counter] or $place->attested objects?
@barryvdh thanks for the help
$counter is used cos I am trying to essentially link two ordered items this loop is inside another , I think by questioning that you have made me realise this is getting overly complicated for a view and the work would be much better done at a higher level
@foreach ($place->historicalForm as $historicalForm)
<li><a href="#histform-<?php echo $counter;?>">{{ $historicalForm}}</a>
<!-- attestations -->
@if($counter<count($place->attested))
@foreach($place->attested[$counter] as $attestation)
<?php $att = (array) $attestation;?>
{{var_dump($att)}}
@endforeach
@endif
<!--end -->
</li>
<?php $counter++;?>
@endforeach
this is what I was doing - which results in array(5) { ["histform"]=> string(5) "Ackle" ["sources"]=> string(2) "Ch" ["sourceId"]=> string(4) "bu15" ["dates"]=> string(4) "1228" ["attestation"]=> string(23) "'wood of Ackle' 1228 Ch" } from the var_dump
As discussed above -> I have now returned the inner array (attested) as a view variable therefore I can use counter to obtain info from that easily -- thanks to all for help
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community