Laravel Voyager Scope use Parameter from Relationship

Viewed 521

I have a question regarding Voyager Laravel Admin (BREAD).

I have a relation ship (ads - belongsTo -> game). And the ads have many types, and the types have also a game parameter. In Voyager it works, i can select a type for the ads. But i want only the types displayed, that are from the same game as the ad. I thought about scope, and i have a function like:

public function scopeGame($query, $game_id)
{
    return $query->where("game_id", $game_id);
}

In Voyager admin:

{
    "scope": "game"
}

But i need to pass the game_id. Does anyone know if this is posible and how?

0 Answers
Related