fix comparing string with bool value
This commit is contained in:
parent
36014020e5
commit
cc6afebfec
|
|
@ -250,7 +250,8 @@ class OptionForm
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($data = Arr::get($_POST, $item->id)) != option($item->id)) {
|
// compare with raw option value
|
||||||
|
if (($data = Arr::get($_POST, $item->id)) != option($item->id, null, true)) {
|
||||||
Option::set($item->id, $data);
|
Option::set($item->id, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ class OptionRepository extends Repository
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $default
|
* @param mixed $default
|
||||||
* @param bool $bool convert '0', '1' to bool value
|
* @param raw $raw return raw value without convertion
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function get($key, $default = null)
|
public function get($key, $default = null, $raw = false)
|
||||||
{
|
{
|
||||||
if (!$this->has($key) && Arr::has(config('options'), $key)) {
|
if (!$this->has($key) && Arr::has(config('options'), $key)) {
|
||||||
$this->set($key, config("options.$key"));
|
$this->set($key, config("options.$key"));
|
||||||
|
|
@ -43,6 +43,8 @@ class OptionRepository extends Repository
|
||||||
|
|
||||||
$value = Arr::get($this->items, $key, $default);
|
$value = Arr::get($this->items, $key, $default);
|
||||||
|
|
||||||
|
if ($raw) return $value;
|
||||||
|
|
||||||
switch (strtolower($value)) {
|
switch (strtolower($value)) {
|
||||||
case 'true':
|
case 'true':
|
||||||
case '(true)':
|
case '(true)':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user