you have merge your list, so you must to add $list
to Form::select()
, like this :
<?php
$tambah = array('tambah' => 'Tambah Kategori Baru');
$list = array_merge(KategoriArtikel::lists('name','id'), $tambah);
?>
{{
Form::select('kategori', $list, Input::old('kategori'),
array(
'class' => 'form-control',
'onChange' => 'changeFunc(value)'
)
)
}}
The second parameter has to be an array in form of key value pairs ($key => $value).
The key ($key => ) will be the value selected and send when an item is choosen and when submitting the form.
The value ( => $value) defines the text displayed in the option tag.
array_map() can be usefull for creating that array.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community