2 weeks ago

Pivot Tables Issue

Posted 2 weeks ago by Conixs

Hello Everyone!

I have 2 issues, the first one: Is it possible to make a pivot relationship return a resource?

esquema_cor' => $this->whenPivotLoaded('xgf_jogo_tema', function () {
    return TemaEsquemaCorResource::collection($this->pivot->esquema_cor_id);

The other one, is how can I make a relationship between 2 pivot tables? I have the following tables:

  • theme
    • theme_id
  • equipment_theme
    • equipment_id
    • theme_id
  • game
    • game_id
  • game_theme
    • game_id
    • theme_id
  • equipment_game_theme
    • equipment_game_id
    • game_id
    • equipment_type
    • equipment_id

I cannot think in a way to access equipment_game_theme with just the Theme and Game models. Is it possible?

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