我有一些数据显示在HTML标题标签中作为工具提示。我在标题标签中有foreach循环。但是由于它位于引号(“”)内,所以缩进变得混乱。我该如何解决?为什么整个代码中的<hr>
标签不起作用?
另外,如果您对此代码有任何想法,请建议我。非常感谢!
缩写代码:
@php
$datas = $event->participants->pluck('date', 'name');
$array = JSON_decode($datas, true);
@endphp
<td class="can_filter"><a href="{{ route('participants.create', $event->id) }}"
data-toggle="tooltip" data-html="true" title="
@foreach ($array as $key=>$value)
{{ $key }} : {{ $value }}
@endforeach
">{{ $event->title }}</a></td>
整个代码:
<hr>
<tbody id="myTable">
@foreach($detail as $event)
@php
$datas = $event->participants->pluck('date', 'name');
$array = JSON_decode($datas, true);
@endphp
<tr>
<td class="can_filter">{{ $event->id }}</td>
<td class="can_filter">{{ $event->your_name }}</td>
<td class="can_filter">{{ $event->email }}</td>
<td class="can_filter"><a href="{{ route('participants.create', $event->id) }}"
data-toggle="tooltip" data-html="true" title="
@foreach ($array as $key=>$value)
{{ $key }} : {{ $value }}
@endforeach
">{{ $event->title }}</a></td>
<td class="can_filter">{{ $event->location }}</td>
<td class="can_filter">{{ $event->description }}</td>
<td class="can_filter">{{ $event->date }}</td>
<td>
<a href="{{ route('events.edit', $event) }}" class="btn btn-primary">
Edit</a>
</td>
<td>
<form action="{{ route('events.destroy', $event->id) }}" method="post">
@csrf
@method('DELETE')
<button class="btn btn-danger" type="submit" name="btn">
Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
原样:
participant1: 2019-02-11
participant2: 2019-09-24
成为:
participant1: 2019-02-11
participant2: 2019-09-24