parseCustomFields($data['custom_fields']); } $company->fill($data); if (array_key_exists('settings', $data)) { $company->saveSettings($data['settings'], $company); } $company->save(); //\Log::error(print_r($company->settings,1)); return $company; } private function parseCustomFields($fields) :array { foreach ($fields as &$value) { $value = (string)$value; } return $fields; } }