Closed chrisrhymes closed 1 year ago
There's a special Laravel has one of many relationship which doesn't need any subquery or scopes.
Thanks, I wasn't aware of the has one of many relationship. I updated the PR with this relationship but the tests are now failing. I think I'll just make this a trait in my own app.
This adds a new trait that can be added to models that already use the activity log. The trait allows the model to have the last activity as a relation of the model or models.
This trait is inspired by this article by Jonathan Reinink.
Or multiple models.
You can also specify the event type to return, such as 'created' or 'updated'.