public function updateOptions($modelName)
    {
        $fieldFactory = app('admin_field_factory');
        $response     = array();

        //iterate over the supplied constrained fields
        foreach ($this->request->input('fields', array()) as $field) {
            //get the constraints, the search term, and the currently-selected items
            $constraints   = array_get($field, 'constraints', array());
            $term          = array_get($field, 'term', array());
            $type          = array_get($field, 'type', false);
            $fieldName     = array_get($field, 'field', false);
            $selectedItems = array_get($field, 'selectedItems', false);

            $response[$fieldName] = $fieldFactory->updateRelationshipOptions($fieldName, $type, $constraints, $selectedItems, $term);
        }

        return response()->json($response);
    }
public function updateOptions($modelName)
    {
        $fieldFactory = app('admin_field_factory');
        $response     = array();

        //iterate over the supplied constrained fields
        foreach ($this->request->input('fields', array()) as $field) {
            //get the constraints, the search term, and the currently-selected items
            $constraints   = array_get($field, 'constraints', array());
            $term          = array_get($field, 'term', array());
            $type          = array_get($field, 'type', false);
            $fieldName     = array_get($field, 'field', false);
            $selectedItems = array_get($field, 'selectedItems', false);

            $response[$fieldName] = $fieldFactory->updateRelationshipOptions($fieldName, $type, $constraints, $selectedItems, $term);
        }

        return response()->json($response);
    }
public function updateOptions ( $ modelName ) { $ fieldFactory = app ( 'admin_field_factory' ) ; $ response = array ( ) ; //iterate over the supplied constrained fields foreach ( $ this -> request -> input ( 'fields' , array ( ) ) as $ field ) { //get the constraints, the search term, and the currently-selected items $ constraints = array_get ( $ field , 'constraints' , array ( ) ) ; $ term = array_get ( $ field , 'term' , array ( ) ) ; $ type = array_get ( $ field , 'type' , false ) ; $ fieldName = array_get ( $ field , 'field' , false ) ; $ selectedItems = array_get ( $ field , 'selectedItems' , false ) ; $ response [ $ fieldName ] = $ fieldFactory -> updateRelationshipOptions ( $ fieldName , $ type , $ constraints , $ selectedItems , $ term ) ; } return response ( ) -> json ( $ response ) ; }
Gets a list of related items given constraints.

@param string $modelName

@return array of objects [{id: string} ... {1: 'name'}, ...]
Gets a list of related items given constraints .