/**
  * Find a configuration by it's key
  * or return a new instance.
  *
  * @param $key
  * @param $scope
  * @return ConfigurationInterface
  */
 public function findByKeyAndScopeOrNew($key, $scope)
 {
     if (!($configuration = $this->model->where('key', $key)->where('scope', $scope)->first())) {
         $configuration = $this->model->newInstance();
         $configuration->setKey($key);
         $configuration->setScope($scope);
     }
     return $configuration;
 }
 /**
  * Get all configurations for a namespace.
  *
  * @param $namespace
  * @param $scope
  * @return ConfigurationCollection
  */
 public function getAll($namespace, $scope)
 {
     $configurations = $this->model->where('scope', $scope)->where('key', 'LIKE', $namespace . '::%')->get();
     return new ConfigurationCollection($configurations->lists('value', 'key'));
 }
 /**
  * Purge a namespace's configuration.
  *
  * @param $namespace
  * @return $this
  */
 public function purge($namespace)
 {
     $this->model->where('key', 'LIKE', $namespace . '::%')->delete();
     return $this;
 }