diff --git a/src/Controllers/Modal.php b/src/Controllers/Modal.php index e1d9989..31f1446 100644 --- a/src/Controllers/Modal.php +++ b/src/Controllers/Modal.php @@ -14,7 +14,7 @@ public function __construct(?string $customKey = null, bool $open = false) $this->open = $open; // replace all characters except letters, numbers , _ and - to _ - $this->customKey = preg_replace('/[^a-zA-Z0-9_-]/', '_', $customKey); + $this->customKey = $customKey ? preg_replace('/[^a-zA-Z0-9_-]/', '_', $customKey) : null; } public static function make(?string $customKey = null): Modal