Git Product home page Git Product logo

laravel-vouchers's Introduction

Laravel Vouchers

An ecommerce voucher generator. It associates vouchers with one or more eloquent model and allows multiple models to own/redeem vouchers.

Documentation

All documentation is available at the documentation site.

๐Ÿ’š Unique Features

  • ๐Ÿ”… Associate one voucher with one or more items
  • โค Flexible Redeemer Models with polymorphic relationship to redeemers. Vouchers can be redeemed by any model. Useful for multi-auth or User/Guest architecture
  • ๐Ÿ“ Use vouchers once or multiple times
  • ๐Ÿ’ช Limit Access: can define model instances that are allowed or excluded from redeeming a Voucher
  • Multiple limit scheme; exhaust redeems per instance, per user or per product
  • Implements moirei/laravel-model-data

Example usage:

$product = Product::find(1);
$voucher = $product->createVoucher();

$user->redeemVoucher($voucher);

Installation

You can install the package via composer:

composer require moirei/laravel-vouchers

Next publish the migration with

php artisan vendor:publish --tag="vouchers-migrations"

Then run the migrations:

php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="vouchers-config"

Notes

  • The allow_models and deny_models attributes mentioned above are actually saved as can_redeem and cannot_redeem internally. They are mutated on boot creating or updating.
  • If you manage your resources with Nova, Nova Multiselect can be used directly with the can_redeem and cannot_redeem attributes. Example code here.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-vouchers's People

Contributors

augustusnaz avatar

Watchers

James Cloos avatar

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.