⏳۵۰٪ تخفیف فقط تا پایان جشنواره؛ بعدش همهچیز به قیمت قبل برمیگرده!
مشاهده دورههاسلام وقت بخیر دوستان من به یک مورد خیلی ساده در بخش ویرایش فرمم در لاراول به مشکل خورم و زمانی که روی دکمه ویرایش کلیک میکنم با خطای : Property [id] does not exist on this collection instance. رو به رو میشم!!
در حالی که بارها در پروژه ها از کنترلر های ریسور و مدل ها استفاده کردم، زمانی که میخوام فرم رو ویرایش کنم با این خطا مواجه میشم، با dd آی دی رو بر میگردونه و حتی return هم میکنم کل دیتا نمایش میده ولی در ویو Edit این خطا رو میده
کنترلر :
`public function edit(Contactinfo $contactinfo) { //dd($contactinfo->id); return view('Admin.contactinfo.edit' , compact('contactinfo')); }`
ویو فرم ویرایش :
@csrf
{{ methodfield('PATCH') }}
@include('Admin.partials.errors')
<div class="form-group">
<label for="id"> id : </label>
<input type="text" class="form-control" id="id" name="id" value="{{ $contactinfo->id }}">
</div>
<div class="form-group">
<label for="tell1"> تلفن یک : </label>
<input type="text" class="form-control" id="tell1" name="tell1" value="{{ $contactinfo->tell1 }}">
</div>
<div class="form-group">
<label for="tell2"> تلفن دو : </label>
<input type="text" class="form-control" id="tell2" name="tell2" value="{{ $contactinfo->tell2 }}">
</div>
<div class="form-group">
<label for="mobile"> موبایل یک : </label>
<input type="text" class="form-control" id="mobile" name="mobile1" value="{{ $contactinfo->mobile1 }}">
</div>
<div class="form-group">
<label for="mobile2"> موبایل دو : </label>
<input type="text" class="form-control" id="mobile2" name="mobile2" value="{{ $contactinfo->mobile2 }}">
<button type="submit" class="btn ripple btn-main-primary btn-block">ارسال</button>
``` </form>
نمیدونم چرا پراپرتی id رو توی روت من نمیگیره!!
شاید پاسخ شما همینجا باشد