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
class Bonus extends Model
{
protected $connection = 'mongodb';
public $timestamps = false;
public function user_bonuses()
{
return $this->hasMany(UserBonus::class);
}
}
UserBonus model is:
class UserBonus extends Model
{
protected $connection = 'mongodb';
protected $fillable = [
'bonus_id',
'user_id',
'wallet_id',
'scope',
'amount',
'status',
'used_at',
];
public function bonuses()
{
return $this->belongsTo(Bonus::class, 'id', 'bonus_id');
}
}
Expected behaviour
As you can see, the code is expected to receive a bonus with all its user bonuses, but I get an exception.
Actual behaviour
But I have this exception: [ErrorException] Declaration of Jenssegers\Mongodb\Relations\HasMany::getRelationQuery(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parent, $columns = Array) should be compatible with Illuminate\Database\Eloquent\Relations\Relation::getRelationQuery()
The text was updated successfully, but these errors were encountered:
BehroozBvk
changed the title
Relation With Not work has exception getRelationQuery incompatible
Relation Not work has exception getRelationQuery incompatible
Jun 23, 2022
Description:
Steps to reproduce
1.This is my code
Expected behaviour
As you can see, the code is expected to receive a bonus with all its user bonuses, but I get an exception.
Actual behaviour
But I have this exception:
[ErrorException] Declaration of Jenssegers\Mongodb\Relations\HasMany::getRelationQuery(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parent, $columns = Array) should be compatible with Illuminate\Database\Eloquent\Relations\Relation::getRelationQuery()
Please, help me.
Thank you.
@jenssegers
The text was updated successfully, but these errors were encountered: