mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Add support for AsCollection::using and AsEnumCollection::of casts
This commit is contained in:
@@ -409,8 +409,6 @@ class ModelsCommand extends Command
|
|||||||
case 'immutable_datetime':
|
case 'immutable_datetime':
|
||||||
$realType = '\Carbon\CarbonImmutable';
|
$realType = '\Carbon\CarbonImmutable';
|
||||||
break;
|
break;
|
||||||
case AsCollection::class:
|
|
||||||
case AsEnumCollection::class:
|
|
||||||
case 'collection':
|
case 'collection':
|
||||||
$realType = '\Illuminate\Support\Collection';
|
$realType = '\Illuminate\Support\Collection';
|
||||||
break;
|
break;
|
||||||
@@ -436,6 +434,18 @@ class ModelsCommand extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Str::startsWith($type, AsCollection::class)) {
|
||||||
|
$realType = $this->getTypeInModel($model, $params[0] ?? null) ?? '\Illuminate\Support\Collection';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Str::startsWith($type, AsEnumCollection::class)) {
|
||||||
|
$realType = '\Illuminate\Support\Collection';
|
||||||
|
$relatedModel = $this->getTypeInModel($model, $params[0] ?? null);
|
||||||
|
if ($relatedModel) {
|
||||||
|
$realType = $this->getCollectionTypeHint($realType, $relatedModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$realType = $this->checkForCastableCasts($realType, $params);
|
$realType = $this->checkForCastableCasts($realType, $params);
|
||||||
$realType = $this->checkForCustomLaravelCasts($realType);
|
$realType = $this->checkForCustomLaravelCasts($realType);
|
||||||
$realType = $this->getTypeOverride($realType);
|
$realType = $this->getTypeOverride($realType);
|
||||||
|
|||||||
Reference in New Issue
Block a user