I have 2 controllers & Models:
User Controller: (Model Relationship:
$this->hasMany(Hero::Class);)Hero Controller: Each hero has his own attributes, such as name, strength and life. Model Relationship: (
$this->belongsTo(User::class);)
Each user can own multiple heroes.
that means that USER ID: 1 may have 3 heroes: HERO ID 5, 20, 26..
My question: How to define the relationships like that and make laravel knows how to handle my user_heroes table?
The relationship i'm talking about is described in the following image:
How to I setup such kind of relationship in my laravel API?

user_idfield in yourherotable, you don't need a pivot table. That's how laravel expects you to set up your database for this kind of relationship.