Add MatrixStateCast and enhance Matrix validation#37
Merged
Conversation
Introduces the MatrixStateCast class for custom state casting in matrix components. Updates Matrix.php to use the new state cast and improves validation logic for row and column selections, supporting both checkbox and radio modes.
Member
|
thank you so much, so far working prefectly ->formatStateUsing(function () {
return [
'companies' => ['c'],
'clients' => ['m' => true, 'p' => true],
];
})still getting the error |
Added a PHPStan ignore comment above the protected $view property in the Matrix component to suppress static analysis warnings.
Appends the column key to the wire:key attribute to ensure unique keys for each input in the matrix-choice Blade component, preventing potential rendering issues with Livewire.
Modified the state casting logic in MatrixStateCast to retain original array keys when the state item is an array, instead of always appending values. This ensures that associative arrays are handled correctly during state transformation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces the MatrixStateCast class for custom state casting in matrix components. Updates Matrix.php to use the new state cast and improves validation logic for row and column selections, supporting both checkbox and radio modes.
Fixes #35