-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eloquent with #17
Comments
Hello! Thanks for your report, however, this is expected as closure parameter types are invariant. See:
I thought this would be fine since most methods you need are defined on the Relation but I'll open an issue with PHPStan to see if there's a way to solve this problem. In the meantime you can override the type inside the closure: $resources = Resource::query()
->whereIn('resource_id', $requestResources)
->with([
'monitorable' => function ($morphTo) {
/** @var MorphTo $morphTo */
$morphTo->morphWith([
Service::class => ['relation1', 'relation2'],
]);
},
]); |
Sorry, but workaround doesn't work...
|
So then use:
|
Description
Starting from Laravel 11.23.* the following error
Laravel code where the issue was found
The text was updated successfully, but these errors were encountered: