settingsKey)->first(); return $setting ? json_decode($setting->value, true) : []; } /** * Guarda una lista de tipos de medios de contacto. * * @param array $types * @return bool */ public function saveContactableTypes(array $types): bool { return Setting::updateOrCreate( ['key' => $this->settingsKey], ['value' => json_encode($types)] ) ? true : false; } /** * Obtiene un tipo de contacto especĂ­fico por ID. * * @param int $id * @return array|null */ public function getTypeById(int $id): ?array { $types = $this->getContactableTypes(); return collect($types)->firstWhere('id', $id); } }