|
@@ -286,7 +286,7 @@ class Model
|
|
|
return $this->store->query($sql, $bind)->fetchColumn();
|
|
|
}
|
|
|
}
|
|
|
- public function value($key, $value = false, $col = 'id,name')
|
|
|
+ public function value($key, $value = false, $col = 'id,name', $data = array())
|
|
|
{
|
|
|
if (isset($this->config['option'][$key])) {
|
|
|
$option = $this->config['option'][$key];
|
|
@@ -296,11 +296,25 @@ class Model
|
|
|
$option = Dever::issets($this->config['struct'][$key], 'value');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (isset($option)) {
|
|
|
- if (is_string($option) && strpos($option, 'Dever') === 0) {
|
|
|
- eval('$option=' . $option . ';');
|
|
|
- } elseif (is_string($option)) {
|
|
|
- $option = Dever::db($option)->select([], ['col' => $col]);
|
|
|
+ if (is_string($option)) {
|
|
|
+ if ($data) {
|
|
|
+ $option = \Dever\Helper\Str::val($option, $data);
|
|
|
+ }
|
|
|
+ if (is_string($option)) {
|
|
|
+ if (strpos($option, 'http') === 0) {
|
|
|
+ if (strpos($option, 'Dever') === 0) {
|
|
|
+ eval('$option=' . $option . ';');
|
|
|
+ }
|
|
|
+ return $option;
|
|
|
+ }
|
|
|
+ if (strpos($option, 'Dever') === 0) {
|
|
|
+ eval('$option=' . $option . ';');
|
|
|
+ } else {
|
|
|
+ $option = Dever::db($option)->select([], ['col' => $col]);
|
|
|
+ }
|
|
|
+ }
|
|
|
} elseif (is_array($option) && !isset($option[0])) {
|
|
|
$temp = $option;
|
|
|
$option = array();
|