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 modelpublic function transporters(){ return $this->belongsToMany(Transporter::class, 'container_transporter') ->withPivot('price');}
// In Container modelpublic function transporters(){ return $this->belongsToMany(Transporter::class, 'container_transporter') ->withPivot('price');}
// In Transporter modelpublic function containers(){ return $this->belongsToMany(Container::class, 'container_transporter') ->withPivot('price');}
// In Transporter modelpublic function containers(){ return $this->belongsToMany(Container::class, 'container_transporter') ->withPivot('price');}