Comments (2)
Cool! Now it makes sense, thanks! 👍
from laravel-counters.
Hi @OzanKurt
thanks for your comment,
first of all I have made a mistake with the methods names **( I have fixed the README.md now)**,
They are
// increment/decrement model objects counters\n
$post->incrementCounter('number_of_views');
$feature->decrementCounter('number_of_bugs');
$user->decrementCounter('balance', 2); // decrement the balance of the user by 2
The idea of this package that you don't need to create a physical column in your model's table, for example no need to create 'number_of_views' column in your Post model. That is perfect when you have many fields that are countables, suppose that a model has 10 ,which means you have to add 10 columns to your model table.
Moreover, you can here specify an initial value to reset the counter to it. In addition, your can customize the step size with every increment/decrement.
Another advantage, you can store public counters like number_of_visitors for your website, without needing to create a whole table to store it.
Best Regards
from laravel-counters.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-counters.