dropdownlist error in Laravel -
hi i'm dot net developer , i'm new php using laravel framework have problem in dropdownlist, did populating data database dropdownlist when i'm saving data dropdownlist id not added in database got null value.
this controller
public function store(request $request) { $this->validate($request, [ 'title' => 'required', 'description' => 'required' ]); $input = $request->all(); task::create($input); session::flash('flash_message', 'task added!'); return redirect()->back(); } public function create() { $category = category::lists('category', 'id'); return view('tasks.create')->with('category', $category); }
and in view
<div class="form-group"> {!! form::label('cagetory_id', 'category:', ['class' => 'control-label']) !!} {!! form::select('cagetory_id', $category, null, ['class' => 'form-control']) !!} </div>
i'm using laravel 5, thank in advance can me :)
check eloquent model, if added 'category_id' mass assignment ($fillable) list.
<?php namespace app; use illuminate\database\eloquent\model; class flight extends model { /** * attributes mass assignable. * * @var array */ protected $fillable = ['name']; }
Comments
Post a Comment