10 months ago

Where on foreign table in belongsToMany relation?

Posted 10 months ago by mastermarco

Every of my users can have more "games", I handle it over belongsToMany relation and the connection is saved in "middle table" 'game_users', model: GameUser.

Now I added field "locked"


public function games(){
    return $this->belongsToMany(Game::class);

how can I add condition with model GameUser in this relation games()? Where GameUser locked = 0?

Please sign in or create an account to participate in this conversation.