Open sebastienheyd opened 3 years ago
+1 for this, but maybe we should add a property to allow other users to opt-in/opt-out of this feature.
For the time being, if you'd like to use @sebastienheyd changes:
Install cweagans/composer-patches
:
composer require cweagans/composer-patches
Download this PR's changes as .patch
and places it ./{PROJECT_ROOT}/patches/venturecraft-revisionable.patch
Update composer.json
with:
....
"extra": {
"laravel": {
"dont-discover": []
},
"patches": {
"venturecraft/revisionable": {
"Get responsible when user is soft deleted": "./patches/venturecraft-revisionable.patch"
}
}
},
...
Run composer install
I've made a package that modify the users to allow to soft delete them.
When a user is soft deleted, the method
userResponsible
will returnnull
, but the user is still in the database and is responsible for the revision. This can cause errors like "cannot get property ...... on null".I've made my own
Revision
class to fix this, but I think this must be included by default because the user is responsible and must be loaded, deleted or not.The fix is very simple, I just added
withTrashed
when getting the user.