original_string: public function references(ModelMetaReferenceRequest $request)
      {
          $modelClass = $request->input('model');
          $type       = $request->input('type');
          $key        = $request->input('key');
  
          $referenceData = $this->getModelMetaReferenceData($modelClass, $type, $key);
  
          if ( ! $referenceData) {
              // @codeCoverageIgnoreStart
              abort(404, "Could not determine reference for {$modelClass} (type: {$type}, key: {$key})");
              // @codeCoverageIgnoreEnd
          }
  
          $search = $request->input('search');
  
          if (is_array($referenceData)) {
  
              $references = [];
  
              foreach ($referenceData as $singleReferenceData) {
                  $references[ $singleReferenceData->model ] = $this->getReferencesByMetaData($singleReferenceData, $search);
              }
  
          } else {
              $references = $this->getReferencesByMetaData($referenceData, $search);
          }
  
          // For now, always return json data, even if the request was not AJAX.
          return response()->json($references);
      }
code: public function references(ModelMetaReferenceRequest $request)
      {
          $modelClass = $request->input('model');
          $type       = $request->input('type');
          $key        = $request->input('key');
  
          $referenceData = $this->getModelMetaReferenceData($modelClass, $type, $key);
  
          if ( ! $referenceData) {
              // @codeCoverageIgnoreStart
              abort(404, "Could not determine reference for {$modelClass} (type: {$type}, key: {$key})");
              // @codeCoverageIgnoreEnd
          }
  
          $search = $request->input('search');
  
          if (is_array($referenceData)) {
  
              $references = [];
  
              foreach ($referenceData as $singleReferenceData) {
                  $references[ $singleReferenceData->model ] = $this->getReferencesByMetaData($singleReferenceData, $search);
              }
  
          } else {
              $references = $this->getReferencesByMetaData($referenceData, $search);
          }
  
          // For now, always return json data, even if the request was not AJAX.
          return response()->json($references);
      }
code_tokens: public function references ( ModelMetaReferenceRequest $ request ) { $ modelClass = $ request -> input ( 'model' ) ; $ type = $ request -> input ( 'type' ) ; $ key = $ request -> input ( 'key' ) ; $ referenceData = $ this -> getModelMetaReferenceData ( $ modelClass , $ type , $ key ) ; if ( ! $ referenceData ) { // @codeCoverageIgnoreStart abort ( 404 , "Could not determine reference for {$modelClass} (type: {$type}, key: {$key})" ) ; // @codeCoverageIgnoreEnd } $ search = $ request -> input ( 'search' ) ; if ( is_array ( $ referenceData ) ) { $ references = [ ] ; foreach ( $ referenceData as $ singleReferenceData ) { $ references [ $ singleReferenceData -> model ] = $ this -> getReferencesByMetaData ( $ singleReferenceData , $ search ) ; } } else { $ references = $ this -> getReferencesByMetaData ( $ referenceData , $ search ) ; } // For now, always return json data, even if the request was not AJAX. return response ( ) -> json ( $ references ) ; }
docstring: Looks up model references by an optional search term.
  
  Targets model information (such as a form field strategy definition) to
  get the details for looking up references.
  
  Useful for relation (autocomplete) select strategies.
  
  @param ModelMetaReferenceRequest $request
  @return mixed
docstring_tokens: Looks up model references by an optional search term .