Create select with pivot relationship

I need to insert a Select with single selta in my project.

The main model of the project is "Game", The select takes data from the Franchise_pivot table in which it has:


-franchise_id
-gioco_id

And where it parses franchise_id (to return the name) in Franchise which is structured:

-id
-name

How can I implement this select?

Currently I have done:

                                     Select::make('Franchise')
                                        ->label('Franchise:')
                                        ->relationship('franchise')
                                        ->searchable(), 


Model "Game"
    public function franchise(): belongsTo
    {
        return $this->belongsTo(Franchise_pivot::class, 'id', 'gioco_id');
    }


But the result is that I have the game id in the select, and not the franchise name
Was this page helpful?