私はElanceと同様の雇用市場を構築しています。ジョブ詳細ページには、提案書もあります。ユーザーはフォームに記入して提出することができます。Laravel ErrorException:非オブジェクトのプロパティを取得しようとしています
ユーザーがプロポーザルデータを編集したい場合、ダッシュボードでそのジョブの編集を押すと、このジョブの詳細ページに再び表示されます。しかし今回は、フォームにデータがあらかじめ埋め込まれています。
これはジョブの詳細な方法であり、requestdetailビュー@includes apply(proposal)フォームです。
public function requestdetail($reqid){
if ($user = Auth::User()) {
$gigs = Gig::where('user_id','=',$user->id)->get();
}
$request = UserRequest::with('request_desc','user.profile')
->findOrFail($reqid);
$proposals = Proposal::with('user')
->where('request_id','=',$reqid)
->orderBy("proposals.created_at","desc")
->get();
return view('user.frontend.public.requestdetail',
compact('reqid','request','proposals','gigs','countProp'));
}
これは編集の提案方法である:
public function edit($proposalid){
$proposal = Proposal::where('id',$proposalid)->first();
$reqid = $proposal->request_id;
$gigid = $proposal->gig_id;
if ($user = Auth::User()) {
$gigs = Gig::where('user_id','=',$user->id)->get();
}
$request = UserRequest::with('request_desc','user.profile')
->findOrFail($reqid);
$proposals = Proposal::with('user')
->where('request_id','=',$reqid)
->orderBy("proposals.created_at","desc")
->get();
return view('user.frontend.public.requestdetail', compact('proposal','reqid','gigid','gigs','countProp','request','proposals'));
}
これは、提案フォームからのフィールドです:
<div class="row">
<div class="col-lg-12">
<label>Description</label>
<textarea id="description" value="{{ $gigid->desc }}" name="description" style="min-height:100px;" class="form-control" rows="5" required=""></textarea>
</div>
</div>
私は仕事の詳細ページを表示すると、それは私にエラーを与える:
私は、 $ gigidと一緒にやっていますが、どうすればこの問題を回避できますか?ここでは作成と編集の部分をどのように扱いますか?あなたのコードを見てみると
ありがとう?それは_gig_または_proposal_のためですか? –
はい、変更されました: value = "{{$ proposal-> desc?$ proposal-> desc: '}}}"ジョブの詳細ページに行くと、今すぐ取得します: ErrorException未定義変数:プロポーザル – chuck