Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/validation' into validation
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Fields/Layouts.php
  • Loading branch information
lee-to committed Feb 2, 2025
2 parents 0496c76 + 6da7f78 commit 7df95f1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Fields/Layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function addLayout(
$headingAdditionalFields,
);

if($validation !== []) {
if ($validation !== []) {
$this->rules[$name] = $validation;
}

Expand Down Expand Up @@ -358,24 +358,22 @@ function (Field $field) use ($value, $index, &$applyValues): void {
*/
protected function resolveBeforeApply(mixed $data): mixed
{
if($this->rules !== []) {
if ($this->rules !== []) {
$value = $this->getRequestValue();

if(!is_array($value)) {
if (! is_array($value)) {
$value = [];
}

$value = Collection::make($value)->mapToGroups(function ($v) {
return [$v['_layout'] => $v];
});
$value = Collection::make($value)->mapToGroups(fn ($v) => [$v['_layout'] => $v]);

$rules = [];
$attributes = [];

foreach ($this->rules as $layoutName => $rule) {
$layout = $this->getLayouts()->findByName($layoutName);

if(\is_null($layout)) {
if (\is_null($layout)) {
continue;
}

Expand Down

0 comments on commit 7df95f1

Please sign in to comment.