【发布时间】:2021-09-28 09:12:38
【问题描述】:
我无法显示在我的 show 函数中调用的项目。 有谁知道为什么什么都没有显示?
路线:
$router->get('/contrats/{id}', [
'as' => 'contrats.show', 'uses' => 'ContratController@show'
]);
我的公共函数 show() :
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(Contrat $contrat)
{
return view('show', compact('contrat'));
}
视图部分:
<p><strong>Contrat n° :</strong> {{ $contrat->id }}</p>
<hr>
<p><strong>Type d'énergie :</strong> {{ $contrat->enrgy }}</p>
<hr>
<p><strong>Numéro gsrn :</strong> {{ $contrat->gsrn }}</p>
<hr>
<p><strong>Durée du contrat : {{ $contrat->duration }} mois</strong></p>
<hr>
<p><strong>Code promotionnel utilisé :</strong> {{ $contrat->codePromo }}</p>
【问题讨论】:
-
你能分享 dd 的输出吗?
{{dd( $contrat->gsrn)}}