mardi 28 mars 2017

Laravel Form Facade For Select with extra Tag on one option

I have a select with this option in html form select.

 <select name="position" id="position" class='position metadata form-control' data-parsley-required data-parsley-required-message="Please select the one position">
             <option value="">Select Position</option>
            
             @foreach($options as $option)
                <option value=""></option>
                @endforeach
            <option value="1" mytag='position'>Define New</option>
        </select> 

The Form Facade for this work like this

$options = App\Metadata::where('category', 'department')->orderBy('item')->pluck('item', 'item');
   $options->prepend('Define New', '1');
   $options->prepend('Select department', '0');
    ?>                                                                                              
{!! Form::select('department', $options , null, ['class' => 'department metadata form-control', 'id'=>'department']) !!}

The problem is how do I add mytag $options->prepend('Define New', '1'); to the last option on the select in the form facade



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire