How do I create a relation manager for a pivot table

Hello,

I have a Container class and I have a Transporter class. i have a pivot table with transporter_id, container_id and price called container_transporter.

I would like to manage the containers and price in the transporter resource.

I have setup my models like this:
// In Container model
public function transporters()
{
    return $this->belongsToMany(Transporter::class, 'container_transporter')
                ->withPivot('price');
}


// In Transporter model
public function containers()
{
    return $this->belongsToMany(Container::class, 'container_transporter')
                ->withPivot('price');
}


How do I set this up in the relationmanager?
Was this page helpful?