<?php
$options = \Mtc\Shop\Property::query()
    ->where('property_type_id', $custom_field_data['custom_field_list_id'])
    ->get()
    ->toArray();

if ($custom_field_data['multiple']) {
    for ($i = 0; $i < $custom_field_data['quantity']; $i++) {
        ?>
        <div class="row">
            <label></label>
            <select name="custom[<?= $custom_field_data['database_field'];?>][<?=$i?>]">
                <option value="">Please Select</option>
                <?php
                foreach ($options as $option) {
                    $selected = ($option['name'] == $values[$custom_field_data['database_field']][$i]) ? ' selected="selected"' : null;
                    ?>
                    <option value="<?=clean_page($option['name']);?>"<?=$selected;?>><?=clean_page($option['name']);?></option>
                <?php
                }
                ?>
            </select>
        </div>
    <?php
    }
} else {
    ?>
    <select name="custom[<?= $custom_field_data['database_field'];?>]">
        <option value="">Please Select</option>
        <?php

        foreach ($options as $option) {
            $selected = ($option['name'] == $values[$custom_field_data['database_field']]) ? ' selected="selected"' : null;
            ?>
                <option value="<?=clean_page($option['name']);?>"<?=$selected;?>><?=clean_page($option['name']);?></option>
        <?php
        }
        ?>
    </select>
<?php
}
