Closed azgooon closed 2 weeks ago
The best way (right now) to overcome this is to add this to your model as a docblock (make sure to use the right model name):
/**
* @method static \Illuminate\Database\Eloquent\Builder|User joinRelation(string $relationName, \Clousure|array$callback = null, string $joinType = 'join', bool $useAlias = false, bool $disableExtraConditions = false, string $morphable = null)
*/
class User extends Model
{
}
@luisdalmolin this works a treat - thank you very much.
Hi,
I checked resolved issues and no one brought this up so I think I am just missing the puzzle rather than reporting an issue. I noticed that when I use i.e joinRelation() method in my laravel project, the chained method (ie groupBy()) afterwards is marked as not defined. This is because joinRelation() returns closure instead of Builder instance. What is the best way to overcome this issue and make IDE "understand" that joinRelation() returns Query Builder and can be chained?
Thanks, Tom.