讨论数量:
public function show($id)
{
$item = YourModel::findOrFail($id); // 获取数据模型
return view('admin.show', ['item' => $item]);
}
{{ $item->title }}
{{ $item->description }}
JSON Data
@php $jsonData = json_decode($item->json_data, true); @endphp
<div class="json-data">
@foreach ($jsonData as $key => $value)
@if ($key === 'image')
<img src="{{ $value }}" alt="Image">
@elseif ($key === 'text')
<p>{{ $value }}</p>
@elseif ($key === 'file')
<a href="{{ $value }}" target="_blank">Download File</a>
@endif
@endforeach
</div>
推荐文章: