laravel-ide-helper
laravel-ide-helper copied to clipboard
Calling scopes after relationships not recognized.
Versions:
- ide-helper Version: 2.8.1
- Laravel Version: 8.9.0
- PHP Version: 7.4.10
Question:
Hi there, I've been using this package for a long time now and I just noticed that when calling a scope from a relationship it is not detected. Is it the correct behavior?
Example: Email.php
public function mails(): BelongsToMany
{
return $this->belongsToMany(Mail::class);
}
public function scopeValid(Builder $query): Builder
{
return $query->where('status', '<>', 'blocked');
}
Mail.php
public function emails(): BelongsToMany
{
return $this->belongsToMany(Email::class);
}
Usage
$mail->emails()->active()->get()
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Same issue here
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
this issue is still present :/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Still present
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Still present
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Still present
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Still present
Still present. I am using latest master branch
public function emails(): BelongsToMany | Email
{
return $this->belongsToMany(Email::class);
}
This will do.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
I'm also running into this:
On Events
public function scheduleSessions(): HasMany|Session
{
return $this->hasMany(Session::class)->whereNull('schedule_session_id')->whereNull('lift_id');
}
On Session
public function scopeSorted($query): Builder
{
return $query->orderBy('gender_id')
->orderBy('age_id')
->orderBy('child_age_id')
->orderBy('session_letter');
}
In use
$scheduleSessions = $this->scheduleSessions()
->with(['scheduleDivisionSessions'])
->sorted()
->get();
Method 'sorted' not found in \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Relations\HasMany