Actually it's more of a question than a bug. What I want is starting by the standard configuration of Laravel Auditing to exclude the user (id and user_type) from the database and only save the email of a user. My attempt was to comment the entire User morph stuff:
and add my own resolver 'user_email' => App\AuditResolvers\UseremailResolver::class to the resolvers array. Also, I changed the migration, removed the user_id and user_type and added user_email. But this however brings me to the following behaviour:
Actual Behaviour
The user_id column is still present in the INSERT INTO audits query.
Error: Column not found: 1054 Unknown column 'user_id' in 'field list'.
Expected Behaviour
Only add insert columns to the query that are listed under the resolvers.
Steps to Reproduce
All that is needed is to comment the entiry user array from the audit.php, as mentioned above.
Possible Solutions
I guess, I need to do more to prevent that from happening and I hope, Laravel Auditing is flexible enough to exlude the User stuff completely. Just commenting out the user array won't stop Laravel Auditing from trying to add user information. However, another possible solution might be to alter the UserResolver to get that behaviour.
Actually it's more of a question than a bug. What I want is starting by the standard configuration of Laravel Auditing to exclude the user (id and user_type) from the database and only save the email of a user. My attempt was to comment the entire User morph stuff:
/*'user' => [ 'morph_prefix' => 'user', 'guards' => [ 'web', 'api' ], 'resolver' => OwenIt\Auditing\Resolvers\UserResolver::class ],*/
and add my own resolver
'user_email' => App\AuditResolvers\UseremailResolver::class
to the resolvers array. Also, I changed the migration, removed the user_id and user_type and added user_email. But this however brings me to the following behaviour:Actual Behaviour
The user_id column is still present in the INSERT INTO audits query. Error: Column not found: 1054 Unknown column 'user_id' in 'field list'.
Expected Behaviour
Only add insert columns to the query that are listed under the resolvers.
Steps to Reproduce
All that is needed is to comment the entiry user array from the audit.php, as mentioned above.
Possible Solutions
I guess, I need to do more to prevent that from happening and I hope, Laravel Auditing is flexible enough to exlude the User stuff completely. Just commenting out the user array won't stop Laravel Auditing from trying to add user information. However, another possible solution might be to alter the UserResolver to get that behaviour.