Is there a way to get all fields in the pivot table instead of to specify one by one?
For example (starting from the guide here):
shops:
- id
- name
products:
- id
- name
product_shop:
- product_id
- shop_id
- field_1
- field_2
- field_3
- ecc...
I do not want to specify each single field:
public function products() {
return $this->belongsToMany('App\Product')
->withPivot('field_1', 'field_2', 'field_3', 'ecc..' );
}
but I would return all available fields in the table; something like ->withPivot('*');
Is there a way?
Thank you.