I have created a drop-down for categories and subcategory. It works fine when i submit the form, but when I edit the form, category field comes as it is to be filled first time.
here is my edit:
<div class="form-group">
{!! Form::label('category','Category:') !!}
<select name="category" id="category" class="form-control input-sm">
@foreach($s as $k)
<option value="{{ $k['id'] }}">{{ $k['name'] }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{!! Form::label('subcategory','Subcategory:') !!}
<select name="subcategory" id="subcategory" class="form-control input-sm">
<option value=""></option>
</select>
</div>
Controller:
public function edit($id)
{
// get the event
$event = Event::findOrFail($id);
$s = Category::all()->where('parent_id','=','0');
$r = Event::all();
$daysOfWeek = unserialize(Event::find($id)->days_of_week);
// show the edit form and pass the event
return view('event.edit',compact('event','s','r','daysOfWeek'));
}
What can i do to get the value stored in database when I do edit form?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/22xYhlG
via IFTTT
Aucun commentaire:
Enregistrer un commentaire