public function cawangan($id) { if (Request::ajax()) { $cawangan = Cawangan::find($id); $cawangan->delete(); return $cawangan->nama; } }
</div> </div> <br /> <div class="control-group"> <label class="control-label" for="selectError">Cawangan (<?php echo $staff->cawangan; ?> )</label> <div class="controls"> <div id="results"> <select data-rel="chosen" name="cawangan" id="cawangan"> <option></option> <?php $selected = ''; if (is_int($staff->cawangan)) { $selected = Cawangan::find($staff->cawangan)->get(); } $cawangan = Cawangan::orderBy('id', 'ASC')->get(); foreach ($cawangan as $tempat) { if ($staff->cawangan == $tempat->id) { $selected = 'selected'; } echo "<option value='" . $tempat->id . "' " . $selected . ">" . $tempat->nama . "</option>"; $selected = ''; } ?> </select> </div> </div> </div> <br />