diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e25557..0975d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## 2.2.10 +- Added support for Repository + ## 2.2.9 - Fix issue when setting data that is a collection - `formSuccess` and `confirmSuccess` events now include the request data as a second argument diff --git a/src/Form.php b/src/Form.php index d158690..e845e3e 100644 --- a/src/Form.php +++ b/src/Form.php @@ -8,8 +8,9 @@ */ namespace UserFrosting\Sprinkle\FormGenerator; -use Illuminate\Support\Collection; +use Illuminate\Contracts\Config\Repository; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Collection; use Illuminate\Support\Str; use UserFrosting\Fortress\RequestSchema\RequestSchemaInterface; @@ -58,10 +59,10 @@ public function setData($data) { if ($data instanceof Collection || $data instanceof Model) { $this->data = $data->toArray(); - } else if (is_array($data)) { + } else if (is_array($data) || $data instanceof Repository) { $this->data = $data; } else { - throw new \InvalidArgumentException("Data must be an array or a Collection"); + throw new \InvalidArgumentException("Data must be an array, a Collection, a Model or a Repository"); } }