public function save()
{
$this->itemsModified = array_unique($this->itemsModified);
try {
foreach ($this->itemsModified as $key) {
if (!DB::table('options')->where('option_name', $key)->first()) {
DB::table('options')->insert(['option_name' => $key, 'option_value' => $this[$key]]);
} else {
DB::table('options')->where('option_name', $key)->update(['option_value' => $this[$key]]);
}
}
// clear the list
$this->itemsModified = [];
} catch (QueryException $e) {
return;
}
}