Caleb White

Results 349 comments of Caleb White

Also, aliases like that are not going to be supported---you'll need to use a selectRaw

It's not supported in Larastan, I suppose we could handle this case right before here though: https://github.com/larastan/larastan/blob/9a87f3ca0ad4a70d81bf67d086fdf4165ea70bda/src/Types/ModelProperty/GenericModelPropertyType.php#L71

I PR'd a fix, but note that trying to access the alias property will still fail---you would have to use the Model public api (i.e., `getAttribute('alias')`)

What does the interface look like? You'll likely have to use an intersection type as the TRelatedModel is expected to be a Model

I don't think you need `getKey` on the interface as that's already on the model. I can take a look and try to return a never type or something if...

@olivernybroe, can you please show how you are defining the relationship?

This is a known limitation, we are unable to determine what the return type should be based on earlier calls---use `createMany` instead

@szepeviktor, yes I believe that should be fine, the bleeding edge config is a sneak peak at the next version of phpstan

This has already been fixed in the [framework](https://github.com/laravel/framework/pull/51851) (for 11.x), and I'm working on a PR to update Larastan

Sounds like we might just need to use the container to get the appropriate guard---call `Auth::guard('...')` and new up the ObjectType from the returned class