etrepat / baum

Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.
http://etrepat.com/baum
MIT License
2.24k stars 459 forks source link

Baum + Soft Deleting throws ModelNotFoundException #280

Open tristanthar opened 7 years ago

tristanthar commented 7 years ago

I enabled soft deleting on my Profile model, and since that Baum throws a ModelNotFoundException whenever I try to call ->save() on my Profile model instances.

I managed to track down the issue to Baum's setDepth() method, where it calls the reload()method. There, it gets a fresh instance of the Model with$fresh = $this->getFreshInstance();, but that returns null and therefore the exception is throwed.

Any ideas how to fix this without breaking Baum functionality?