You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue occurs with the following query, when you join the two relational database models and attempt to use the whereHas into the third relation which is a MongoDB Model.
Example
class Tree extendsIlluminate\Database\Eloquent\Model
{
use HybridRelations;
publicfunctionapples(): HasMany
{
return$this->hasMany(Apple::class, 'tree_id');
}
publicfunctionseeds(): HasMany
{
return$this->hasMany(Seed::class, 'tree_id');
}
}
class Apple extendsIlluminate\Database\Eloquent\Model
{
use HybridRelations;
publicfunctiontree(): BelongsTo
{
return$this->belongsTo(Tree::class, 'tree_id');
}
publicfunctionseeds(): HasMany
{
return$this->hasMany(Seed::class, 'apple_id');
}
}
@Smolevich Tree and Apple are mysql relations as you can see on the inherited namespace extendsIlluminate\Database\Eloquent\Model. Only Seed is a Mongodb model.
Description
The issue occurs with the following query, when you join the two relational database models and attempt to use the whereHas into the third relation which is a MongoDB Model.
Example
Exception
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous...
The text was updated successfully, but these errors were encountered: