Skip to content

Commit

Permalink
Merge pull request #15711 from RoyHridoy/fix/panel-creation-validation
Browse files Browse the repository at this point in the history
Add Input Validation When Creating Panel
  • Loading branch information
danharrin authored Feb 25, 2025
2 parents 8a19e7c + ac3538a commit 9b1cfa5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/support/src/Commands/Concerns/CanGeneratePanels.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public function generatePanel(?string $id = null, string $default = '', string $
placeholder: $placeholder,
default: $default,
required: true,
validate: fn (string $value) => match (true) {
preg_match('/^[a-zA-Z].*/', $value) => null,
default => 'The ID must start with a letter, and not a number or special character.',
},
));

$class = (string) str($id)
Expand Down

0 comments on commit 9b1cfa5

Please sign in to comment.