Example #1
0
 /**
  * Resolves a Config instance.
  *
  * @return ModelConfig The resolved config.
  */
 public function resolve()
 {
     if (is_null($this->config->getDisplayField()) || $this->config->getDisplayField() == '') {
         $this->config->setDisplayField($this->resolveDisplayField());
         $this->config->setVisibleFields($this->resolveVisibleFields());
     }
     return $this->config;
 }
 /**
  * @Given /^there is a model "([^"]*)"$/
  */
 public function thereIsAModel($modelName)
 {
     if (!class_exists($modelName)) {
         eval('class ' . $modelName . ' extends \\Illuminate\\Database\\Eloquent\\Model {  }');
     }
     $this->models[] = $modelName;
     $this->lastModel = $modelName;
     $config = new ModelConfig($modelName);
     $this->lastConfig = $config;
     $this->databaseHelper->shouldReceive('hasTable')->with($config->getTableName())->andReturn(true);
 }
 /**
  * Returns whether given model is searchable, using the `ModelConfig` class for the `Model`.
  * Uses the overridden value if present, or falls back to the generated value.
  *
  * @param Model       $model  The `Model` to check.
  * @param ModelConfig $config The `ModelConfig` to use for checking.
  *
  * @return bool `true` if the model is searchable.
  */
 public function isSearchable(Model $model, ModelConfig $config = null)
 {
     if (empty($this->models)) {
         throw new \LogicException('AujaConfigurator not configured yet! Call configure first.');
     }
     if (!isset($this->configs[$model->getName()])) {
         throw new \LogicException(sprintf('AujaConfigurator not configured for model %s', $model->getName()));
     }
     $result = false;
     if ($config != null) {
         $result = $config->isSearchable();
     } else {
         $modelConfig = $this->configs[$model->getName()];
         $result = $modelConfig->isSearchable();
     }
     return $result;
 }