{"repo":"spatie/laravel-model-flags","free":true,"listed":false,"github":"https://github.com/spatie/laravel-model-flags","clone":"git clone https://github.com/spatie/laravel-model-flags.git","description":"Add flags to Eloquent models","language":"PHP","stars":456,"topics":["eloquent","flags","laravel","model"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Add flags to Eloquent models This package offers a trait that allows you to add flags to an Eloquent model. These can be used to quickly save the state of a process, update, migration, etc... to a model, without having to add an additional column using migrations. It also provides scopes to quickly query all models with a certain flag. Though there are other usages, the primary use case of this package is to easily build idempotent (aka restartable) pieces of code. For example, when writing an Artisan command that sends a mail to each user. Using flags, you can make sure that when the command is cancelled (or fails) half-way through, in the second invocation, a mail will only be sent to users that haven't received one yet. No matter how many times you would execute this command, users would only get the mail once. Support us We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. Installation You can install the package via Composer: Behind the scenes, the flags and the relation to a model will be stored in the flags table. To create that flags table, you must publish and run the migrations once with: Optionally, you can publish the config file with: This is the contents of the","default_branch":null,"files":null,"tree":[],"storefront":"/r/spatie","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/spatie/laravel-model-flags/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}