I use Laravel version 5.1 and I need ideas how to output a specific dynamic variable(data-target) outside of foreach.
The modal div(bootstrap modal) it must be outside of foreach!
What is the best to use php or jquery and how to solve this problem?
Html and Laravel(php):
@foreach ($category as $name => $value)
<li>
<a href="">{{$value->category_name}}</a>
<button type="button" class="btn btn-warning fa fa-pencil-square-o pull-right easy" data-toggle="modal" data-target="#{{$value->id}}"></button>
...
</li>
@endforeach
<div class="modal fade" id="{{$value->id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
...
</div>
foreach?foreachfor that specific element.foreach. If there are just few modals and no heavy data loaded (like graphics or big texts), it's easier to do this withforeachrather than with AJAX.