Skip to content

Commit

Permalink
Fix many problems
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Oct 21, 2023
1 parent e7c2cbb commit 17409e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Fields/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(string $label, string $modelAttribute = null)
*/
public function getValueForHydrate(Request $request): mixed
{
return $request->boolean([$this->getRequestKey()]);
return $request->boolean($this->getRequestKey());
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Fields/Fieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ protected function resolveField(Request $request, Field $field): void
*/
public function persist(Request $request, Model $model, mixed $value): void
{
$this->resolveFields($request)->each(static function (Field $field) use ($request): void {
$field->persist($request, $field->getValueForHydrate($request));
$this->resolveFields($request)->each(static function (Field $field) use ($request, $model): void {
$field->persist($request, $model, $field->getValueForHydrate($request));
});
}

Expand All @@ -41,8 +41,8 @@ public function persist(Request $request, Model $model, mixed $value): void
*/
public function resolveHydrate(Request $request, Model $model, mixed $value): void
{
$this->resolveFields($request)->each(static function (Field $field) use ($request): void {
$field->resolveHydrate($request, $field->getValueForHydrate($request));
$this->resolveFields($request)->each(static function (Field $field) use ($request, $model): void {
$field->resolveHydrate($request, $model, $field->getValueForHydrate($request));
});
}

Expand Down Expand Up @@ -77,7 +77,7 @@ public function toValidate(Request $request, Model $model): array
{
return array_merge(
parent::toValidate($request, $model),
$this->resolveFields($request)->mapToValidate($request)
$this->resolveFields($request)->mapToValidate($request, $model)
);
}
}

0 comments on commit 17409e5

Please sign in to comment.