我必须为我的国家的学生宿舍建立一个网站,我为每一个宿舍都有一个特别的页面,上面显示了所有的照片和财产,但是如果有人能帮我的话,我不知道如果有人能帮我的话,我怎么能用宿舍id来做这件事呢?谢谢大家
这是我的宿舍控制器代码:
class HostelDetailsController extends Controller
{
public function index(Request $request,$detail_id)
{
// $id = $request->query($detail_id);
$file_details = HostelDetails::all();
$files = Attachment::get();
return view('khabgah_details', compact(['file_details', 'files']));
}
}这是我的宿舍页面刀片代码:
@foreach($file_details as $file)
<div class="card-title text-center">
<div class="mt-4"></div>
<i class="fa fa-home mt-4 text-center" style="font-size:45px;"></i>
<h5 class="mt-3 text-center"> لیلیه نرگس </h5>
<h6 class="fa fa-phone"> شماره تماس: {{ $file->phone_number }} </h6>
</div>
@endforeach它没有显示任何错误消息,但是当我加载页面时,它会显示表中的所有记录
发布于 2019-09-12 05:45:34
//You can get the id from the index page of the hostel
public function show($id)
{
$details = Detail::where('hostel_id', '=', $id)->get();
return view('HostelDetailPage',compact('details'));
}https://stackoverflow.com/questions/57900266
复制相似问题