Skip to content
Advertisement

How to add index in laravel blade html attribute while calling?

This is my controller code –

JavaScript

This is my database –

JavaScript

This is my report.blade.php

JavaScript

Whenever user click on show answers , it should display answers in bootstrap modal. For that below is the code ..

JavaScript

In modal instead of

JavaScript

What should i pass here so that all questions should pick its increment and display correctly like question_1, question_2, question_3 so on..

now with the help of count variable it’s working fine

JavaScript

but there is some mistake in this line @if ( {{ $r->{‘question_’ . $count} }} == 1 ) yes @else no @endif. Can anybody identify?

Advertisement

Answer

In your blade add $count,

JavaScript

You can refer more about Get PHP class property by string

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement