lundi 18 janvier 2016

Dynamically populate the drown-down for list of devices and apply change to a single record

I created a table of devices and each device belongs to an organization.

The organization names are shown as a drop down list.

I populated the drop list successfully (see picture) but whenever i change the organization for a single device the rest of devices are updated as well ! (see picture)

how can i apply the change to a single device?

here is the devices list view:

@foreach($devices as $device)

<td>
                    <div class="row">
                        <div class="col-md-3">

                            {!! Form::model($device,['url'=>'admin/device/'.$device->id,'method'=>'patch']) !!}
{{--                                {!! Form::text('organization_id',old('organization_id'), ['class'=>'form-control','size'=>'3']) !!}--}}
                            {!! Form::select('Organization_id',(['' => 'Select Organization']+ $orgs_names),null,['class' => 'form-control']) !!}

                        </div>

                        <div class="col-md-3">

                            {!! Form::submit('Assign',["class"=>"btn btn-success form-control"]) !!}
                            {!! Form::close() !!}

                        </div>

                    </div>


                </td>

Device Controller:

$orgs_names = Organization::lists('name','id')->all();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire