laravel-pivot-softdeletes icon indicating copy to clipboard operation
laravel-pivot-softdeletes copied to clipboard

Support for MorphToMany

Open Scarwolf opened this issue 3 years ago • 0 comments

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.

Scarwolf avatar Apr 22 '21 12:04 Scarwolf