1
0
Fork 0
mirror of https://github.com/archtechx/airwire.git synced 2025-12-12 02:34:04 +00:00
This commit is contained in:
Samuel Štancl 2021-05-22 15:47:50 +02:00
parent f5fc60f4bc
commit 1bbc27230f

View file

@ -68,7 +68,7 @@ class TypehintConverter
$this->namedTypes[$alias] = 'pending'; // We do this to avoid infinite loops when recursively generating model type definitions $this->namedTypes[$alias] = 'pending'; // We do this to avoid infinite loops when recursively generating model type definitions
$values = $model->toArray() $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 ?: collect(Schema::getColumnListing($model->getTable()))->mapWithKeys(fn (string $column) => [$column => []])->toArray(); // [] for any
$this->namedTypes[$alias] = '{ ' . $this->namedTypes[$alias] = '{ ' .