Laravel-activitylog: User deleted

Created on 14 Oct 2016  Â·  4Comments  Â·  Source: spatie/laravel-activitylog

Hi,
If I have some logs and a user gets deleted. I then have no way of getting the causer email because the causer no longer exists. Is there a way of handling this?

All 4 comments

You could log a new activity with a description that contains the
emailaddress right before deleting the user (or use a custom property)

Another route would be to use soft deletes on your user model.

On Friday, 14 October 2016, Chris [email protected] wrote:

Hi,
If I have some logs and a user gets deleted. I then have no way of getting
the causer email because the causer no longer exists. Is there a way of
handling this?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/spatie/laravel-activitylog/issues/94, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAdiDerysAO5Zxhy7XChRUmYYaI5_OOYks5qz-mBgaJpZM4KXbBG
.

Freek Van der Herten
https://spatie.be
+32 495 84 27 91

How would I go about including softDeleted users in the causer method?

[needs official approval]

Just make another Model wich extends Spatie\Activitylog\Models\Activity !!
and edit the causer method just like the subject method

image

and in the file
config/activitylog.php set the new Model as the current Activity model

image

@fr4j4 one thing you miss.
Screenshot 2020-09-17 183126

It's working fine. Thanks to @fr4j4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cscognamiglio picture cscognamiglio  Â·  6Comments

lflucasferreira picture lflucasferreira  Â·  3Comments

TheFrankman picture TheFrankman  Â·  5Comments

BerendSpigt picture BerendSpigt  Â·  4Comments

lucianobosco picture lucianobosco  Â·  5Comments