eloquent-viewable | Associate views with Eloquent models in Laravel | Database library
kandi X-RAY | eloquent-viewable Summary
kandi X-RAY | eloquent-viewable Summary
Sometimes you don't want to pull in a third-party service like Google Analytics to track your application's page views. Then this package comes in handy. Eloquent Viewable allows you to easiliy associate views with Eloquent models. It's designed with simplicity in mind. This package stores each view record individually in the database. The advantage of this is that it allows us to make very specific counts. For example, if we want to know how many people has viewed a specific post between January 10 and February 17 in 2018, we can do the following: views($post)->period(Period::create('10-01-2018', '17-02-2018'))->count();. The disadvantage of this is that your database can grow rapidly in size depending on the amount of visitors your application has.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Register the service provider .
- Bootstrap the application .
- Scope with view count .
- Query scope to include views within a given period .
- Query scope for order by views count .
- Listen to the deleted event .
- Get the connection name .
- Thrown when start date is not after end date .
- Removes views on delete .
- Get the facade accessor .
eloquent-viewable Key Features
eloquent-viewable Examples and Code Snippets
Community Discussions
Trending Discussions on eloquent-viewable
QUESTION
I have an articles site based on Laravel and Vue, I want to count the number of visits for each article (when the user opens the article the number of visits increases by one), in Laravel I used the eloquent-viewable package, but with Laravel + Vue I don't know how to do it.
can you help me please
...ANSWER
Answered 2021-May-09 at 02:56you can try this approach
in your mount event register this function
QUESTION
Im using cyrildewit/eloquent-viewable package to get page views. When I check out the documentation, I don't see a method where I can only get views for a single date. It uses Period and Carbon to get dates in a particular period so the (since and upTo) functions.
Any fix or alternative package to get page views.
I am trying to create a analytics page.
...ANSWER
Answered 2020-May-01 at 16:26You're not limited to since and upto, Period has (as per what I can see there https://github.com/cyrildewit/eloquent-viewable/blob/master/src/Support/Period.php) a create method that can take any date as start and end:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install eloquent-viewable
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page