you have verified and unverified ?
Dec 5, 2021
7
Level 5
"scopeUnverified" returns Call to an undefined method \HasMany::verified() in Larastan
Hello,
I am working with Larastan; at the moment, I am facing a little problem: Larastan throws out the following error:
137 Call to an undefined method Illuminate\Database\Eloquent\Relations\HasMany::verified().
Alright, so I had a look at it.
I defined a scope like this:
/**
* @param $query
*
* @return mixed
*/
public function scopeVerified($query): mixed
{
return $query->where('verified', 1);
}
This scope is being used like this:
$verified_images = $images->verified()->count();
The relation looks like this:
/**
* @return HasMany
*/
public function images(): HasMany
{
return $this->hasMany(Image::class);
}
The code itself works fine - it is doing what it's supposed to do. But how can I get rid of the error in Larastan?
Please or to participate in this conversation.