From 1bbc27230f2cdace2e33c93fb55e38dcac1f2699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 22 May 2021 15:47:50 +0200 Subject: [PATCH] first()? --- src/TypehintConverter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TypehintConverter.php b/src/TypehintConverter.php index 2bb71d0..3da417b 100644 --- a/src/TypehintConverter.php +++ b/src/TypehintConverter.php @@ -68,7 +68,7 @@ class TypehintConverter $this->namedTypes[$alias] = 'pending'; // We do this to avoid infinite loops when recursively generating model type definitions $values = $model->toArray() - ?: $model->first()->toArray() // If this model is empty, attempt finding the first one in the DB + ?: $model->first()?->toArray() // If this model is empty, attempt finding the first one in the DB ?: collect(Schema::getColumnListing($model->getTable()))->mapWithKeys(fn (string $column) => [$column => []])->toArray(); // [] for any $this->namedTypes[$alias] = '{ ' .