mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-18 05:58:20 +01:00
Add FieldCollection::setValuesFromRequest()
method
This commit is contained in:
parent
91e05505dc
commit
a2d5862064
@ -4,6 +4,7 @@ namespace Formwork\Fields;
|
||||
|
||||
use Formwork\Data\AbstractCollection;
|
||||
use Formwork\Fields\Layout\Layout;
|
||||
use Formwork\Http\Request;
|
||||
use Formwork\Model\Model;
|
||||
use Formwork\Utils\Arr;
|
||||
|
||||
@ -100,4 +101,13 @@ class FieldCollection extends AbstractCollection
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setValuesFromRequest(Request $request, mixed $default = null): static
|
||||
{
|
||||
return $this->setValues([
|
||||
...$request->query()->toArray(),
|
||||
...$request->input()->toArray(),
|
||||
...$request->files()->toArray(),
|
||||
], $default);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user