laravel-pivot-softdeletes
laravel-pivot-softdeletes copied to clipboard
Support for MorphToMany
First of all, great small package!
It seems like MorphToMany Relationships are not supported.
/**
* The rooms this item is stored in.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function inRooms(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{
return $this
->morphedByMany(Room::class, 'location', 'location_has_items')
->withPivot('id')
->using(LocationHasItem::class)
->withSoftDeletes();
}
Call to undefined method Illuminate\Database\Eloquent\Relations\MorphToMany::withSoftDeletes()
The Class I'm using this on is extending \DDZobov\PivotSoftDeletes\Model
.