Support the ongoing development of Laravel.io →
Database Views Forms
Last updated 2 years ago.
0

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)' 
    )
 ) 
 }}
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

t0n1zz t0n1zz Joined 8 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.