Skip to content

Commit

Permalink
Merge pull request #14 from Stefan-Dressler/master
Browse files Browse the repository at this point in the history
  • Loading branch information
janiskelemen authored Dec 13, 2022
2 parents 8d155bd + d8e40c5 commit e6791f7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ public function get($key, $default_value = null)
return $setting;
}

/**
* Returns the data in value field only
*
* @param string $key
* @param string $value
* @return void
*/
public function getValuesOnly($key, $default_value = null)
{
$values = $this->get($key, $default_value);
return collect($values)->map(function ($item, $key) {
if (is_array($item) && array_key_exists('value', $item)) {
return $item['value'];
}
return $item;
})->all();
}

/**
* Recursivly merge array values of a given key with config file values.
*
Expand Down

0 comments on commit e6791f7

Please sign in to comment.