Hi @benko ,
Is it correct that you are asking how to obtain the extra columns as defined in the set_exercise pivot table?
If so, you'll first need to load them in your Exercise and/or Set model as follows:
// Set.php (model)
public function exercises()
{
return $this->belongsToMany(Exercise::class)->withPivot('extra_column1', 'extra_column2');
}
Now you can retrieve them, when you collect the exercises in a set:
foreach ($set->exercises() as $exercise) {
echo $exercise->extra_column1;
}
This is a tweaked example from the documentation (https://laravel.com/docs/5.8/eloquent-relationships#many-to-many)