/**
  * Handle the options.
  *
  * @param RelationshipFieldType     $fieldType
  * @param FieldRepositoryInterface  $fields
  * @param StreamRepositoryInterface $streams
  * @return array
  */
 public function handle(RelationshipFieldType $fieldType, FieldRepositoryInterface $fields, StreamRepositoryInterface $streams)
 {
     $stream = array_get($fieldType->getConfig(), 'stream');
     $unlocked = array_get($fieldType->getConfig(), 'unlocked');
     $namespace = array_get($fieldType->getConfig(), 'namespace');
     $fields = $fields->findAllByNamespace($namespace);
     if ($stream && ($stream = $streams->findBySlugAndNamespace($stream, $namespace))) {
         $fields = $fields->assignedTo($stream);
     }
     if ($unlocked) {
         $fields = $fields->unlocked();
     }
     $fieldType->setOptions(array_combine($fields->lists('id')->toArray(), $fields->lists('name')->toArray()));
 }
 /**
  * Handle the options.
  *
  * @param RelationshipFieldType $fieldType
  * @return array
  */
 public function handle(RelationshipFieldType $fieldType)
 {
     $model = $fieldType->getRelatedModel();
     $query = $model->newQuery();
     $fieldType->setOptions($query->get()->lists($model->getTitleName(), $model->getKeyName())->all());
 }