'required', 'key' => 'required', 'group' => 'required', ]; /** * @param $key * * @return mixed */ public static function formatKey($key) { return str_replace('.', '_', strtolower($key)); } /** * Force formatting the key * * @param $id */ public function setIdAttribute($id): void { $id = strtolower($id); $this->attributes['id'] = self::formatKey($id); } /** * Set the key to lowercase * * @param $key */ public function setKeyAttribute($key): void { $this->attributes['key'] = strtolower($key); } }