diff --git a/README.md b/README.md index a35b04be..760b074a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ php artisan vendor:publish --tag="wireuse-config" You will find full documentation on the dedicated [documentation](https://foxws.nl/projects/wireuse) site. +> NOTE: The documentation is far from complete, see [this discussion](https://github.com/foxws/wireuse/discussions/3) for progress. + ## Testing ```bash diff --git a/src/Forms/Concerns/WithForm.php b/src/Forms/Concerns/WithForm.php index 2bd4c36d..d602188d 100644 --- a/src/Forms/Concerns/WithForm.php +++ b/src/Forms/Concerns/WithForm.php @@ -3,6 +3,7 @@ namespace Foxws\WireUse\Forms\Concerns; use Illuminate\Support\Collection; +use Illuminate\Support\Fluent; use Illuminate\Validation\ValidationException; use ReflectionProperty; @@ -15,11 +16,18 @@ protected function getType(string $property): string return $instance->getType()->getName(); } - protected function collect(...$properties): Collection + protected function toCollection(...$properties): Collection { return $properties - ? collect($this->only(...$properties)) - : collect($this->all()); + ? new Collection($this->only(...$properties)) + : new Collection($this->all()); + } + + protected function toFluent(...$properties): Fluent + { + return $properties + ? new Fluent($this->only(...$properties)) + : new Fluent($this->all()); } protected function keys(): array @@ -34,7 +42,7 @@ public function get(string $property, mixed $default = null): mixed public function has(...$properties): bool { - return $this->collect() + return $this->toCollection() ->has($properties); } @@ -61,14 +69,14 @@ public function isStrict(string $property, mixed $args = null): bool public function filled(...$properties): bool { - return $this->collect($properties) + return $this->toCollection($properties) ->filter() ->isNotEmpty(); } public function blank(...$properties): bool { - return $this->collect($properties) + return $this->toCollection($properties) ->filter() ->isEmpty(); }