'required', 'key' => 'required', 'group' => 'required', ]; /** * @param $key * * @return string */ public static function formatKey($key): string { return str_replace('.', '_', strtolower($key)); } /** * Force formatting the key * * @return Attribute */ public function id(): Attribute { return Attribute::make( get: fn ($id, $attrs) => self::formatKey(strtolower($id)) ); } /** * Set the key to lowercase * * @return Attribute */ public function key(): Attribute { return Attribute::make( set: fn ($key) => strtolower($key) ); } }