Giter Site home page Giter Site logo

Comments (2)

OzanKurt avatar OzanKurt commented on May 9, 2024 1

Cool! Now it makes sense, thanks! 👍

from laravel-counters.

MaherSaleem avatar MaherSaleem commented on May 9, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.