cyrildewit / eloquent-viewable

Associate views with Eloquent models in Laravel
MIT License
826 stars 105 forks source link

Feature idea: extra metadata when recording view #218

Closed dmyers closed 3 years ago

dmyers commented 4 years ago

Extra data such as user ID, IP address, user agent would be valuable to store when recording views.

cyrildewit commented 4 years ago

Thank you for your suggestion. This feature has already been on the table for quite long now. I never persisted with it, because I try to keep the package as minimal as possible. After reelevating it, I think it will be a good addition to the package.

I wonder what you think of solution used in spatie/laravel-activitylog.

Another possibility would be to leverage this functionality to spatie/laravel-schemaless-attributes.

riyanamanda commented 4 years ago

can't wait for the update, visitor data is too low. i tried to override the class with my own but I got confused. i hope it would record general used data in real case.

cyrildewit commented 3 years ago

If you want this functionality please take a look at the following example: https://github.com/cyrildewit/eloquent-viewable-demo-app/pull/14

The same steps apply to other solutions/packages.