cyrildewit / eloquent-viewable

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

Is there a way to record a view on cyrildewit / eloquent-viewable with the user_id not just the viewable_id #275

Closed Fajendagba closed 1 year ago

Fajendagba commented 2 years ago

So I'm using cyrildewit/eloquent-viewable which works fine with recoding views with post, but I would also like to be able to know if an authenticated user (User Model) has viewed a post.

Does anyone have any suggestion on this.

cyrildewit commented 1 year ago

The current visitor reference is managed by the Visitor class. By default this is a cookie ID. You can add a user_id column to the views table or create a linking table. You should be able to extend the Views class to support setting the user_id of an view before recording it.