miso
3 years ago

Transactional activity feed / audit

Posted 3 years ago by miso

Hi, there is a nice video about how to implement RecordsActivity trait which uses Model events and inserts data to the database on various events: https://laracasts.com/lessons/build-an-activity-feed-in-laravel and https://github.com/laracasts/Build-An-Activity-Feed-in-Laravel

I would like to make it transactional (always store audit data AND the subject, or do not store anything), but I am not sure how to implement it with the model events.

Should I begin the transaction on creating and end the transaction on created?

Thank you for suggestions.

Please sign in or create an account to participate in this conversation.