src/Label305/AujaLaravel/Factory/FormItemFactory.php
private function createSelectAssociationFormItem(Model $model, Column $column, $item) {
        $result = new SelectFormItem();

        $relations = $this->aujaConfigurator->getRelationsForModel($model);
        $relatedModel = null;
        foreach ($relations as $relation) {
            $rightModel = $relation->getRight();
            if (starts_with($column->getName(), camel_case($rightModel->getName()))) {
                $relatedModel = $rightModel;
            }
        }

        if ($relatedModel != null) {
            $displayName = $this->aujaConfigurator->getDisplayName($relatedModel);
            $result->setName($displayName);

            $result->setValue($item->id);

            $items = call_user_func(array($relatedModel->getName(), 'all'));
            $displayField = $this->aujaConfigurator->getDisplayField($relatedModel);
            foreach ($items as $item) {
                $label = isset($item->$displayField) ? $item->$displayField : '';
                $value = $item->id;

                $option = new SelectOption($label, $value);
                $result->addOption($option);
            }
        }

        return $result;
    }
private function createSelectAssociationFormItem(Model $model, Column $column, $item) {
        $result = new SelectFormItem();

        $relations = $this->aujaConfigurator->getRelationsForModel($model);
        $relatedModel = null;
        foreach ($relations as $relation) {
            $rightModel = $relation->getRight();
            if (starts_with($column->getName(), camel_case($rightModel->getName()))) {
                $relatedModel = $rightModel;
            }
        }

        if ($relatedModel != null) {
            $displayName = $this->aujaConfigurator->getDisplayName($relatedModel);
            $result->setName($displayName);

            $result->setValue($item->id);

            $items = call_user_func(array($relatedModel->getName(), 'all'));
            $displayField = $this->aujaConfigurator->getDisplayField($relatedModel);
            foreach ($items as $item) {
                $label = isset($item->$displayField) ? $item->$displayField : '';
                $value = $item->id;

                $option = new SelectOption($label, $value);
                $result->addOption($option);
            }
        }

        return $result;
    }
Returns a `SelectFormItem` which is filled with instances of the model given `Column` represents.

@param Model     $model  The `Model` which contains given `Column`.
@param Column    $column The `Column` which represents a related model.
@param \Eloquent $item   The instance to retrieve information from for filling the `SelectFormItem`.

@return SelectFormItem The created `SelectFormItem`.