I am learning to log an activity in Laravel(7.1) using spatie/laravel-activitylog
package. But when I update an user, it does not update properties
column in activity_log
table, I set $logAttributes
attribute on model (protected static $logAttributes = ['name', 'email'];
)
When I update an user like
>>> $user = User::find(1);
=> App\User {#3104
id: 1,
name: "John",
email: "prath@example.com",
email_verified_at: "2020-03-12 13:35:19",
created_at: "2020-03-12 13:35:19",
updated_at: "2020-03-12 13:41:34",
}
>>> $user->update(['name' => 'James']);
=> true
and it logs that activity but returns with an empty properties column.
{
id: 8,
log_name: "default",
description: "updated",
subject_id: 1,
subject_type: "App\User",
causer_id: null,
causer_type: null,
properties: [ ],
created_at: "2020-03-12T14:58:10.000000Z",
updated_at: "2020-03-12T14:58:10.000000Z"
}