0

Expected Behaviour

I'm auditing the Product model currently but I just want to audit the model when a specific user makes any change, is there any way I could achieve this?

Possible Solutions

It would be great if the Developer get the control to set the particular set of userID on Model as

protected $user_ids = [1,2,3];

  • Framework | Laravel
  • Framework version | 7.x
  • Package Name | owen-it/laravel-auditing
  • Package version | 11.0
  • PHP version | 7.3
Mudit Gulgulia
  • 1,131
  • 7
  • 21

1 Answers1

1

You could try listening for the auditing event, OwenIt\Auditing\Events\Auditing, that this package fires off. You could check what you need to at that point and return false from the listener if you want it to not do the audit.

lagbox
  • 48,571
  • 8
  • 72
  • 83
  • Will try this and let you know. – Mudit Gulgulia Nov 25 '20 at 09:02
  • Thank you, it worked for me. and if someone else faces the same issue you can make a listener and register it to EventServiceProvider with `OwenIt\Auditing\Events\Auditing` like this `Auditing::class => [\App\Listeners\AuditingListener::class]` – Mudit Gulgulia Nov 25 '20 at 09:08