public static function set($key, $value = null) { if (is_array($key)) { foreach ($key as $k => $v) { self::set($k, $v); } return; } self::updateOrCreate(compact('key'), compact('value')); }
public function testGet() { Setting::set('foo', 'bar'); Setting::set('bar', ['baz' => 'qux']); $this->assertEquals('bar', Setting::get('foo')); $this->assertEquals(['baz' => 'qux'], Setting::get('bar')); }