2017 © Pedro Peláez
 

library promocode

image

bu4ak/promocode

  • Saturday, March 3, 2018
  • by bu4ak
  • Repository
  • 1 Watchers
  • 0 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

A small model that generates a discount code

Installation:
  • composer require bu4ak/promocode
  • php artisan migrate
Usage example:
  • Generate:
$promo = \Bu4ak\Promocode\Models\Promocode::generate(10, 5);

route('promo', ['hash' => $promo->hash]); 
// invitation link:
// http://localhost/promo/356ce01e0258f76ad83a7734b28142f144264689e8983b38f0f5948bae6dda51

  • Url handling:
Route::get('/promo/{hash}', function ($hash) {
    $promo = \Bu4ak\Promocode\Models\Promocode::whereHash($hash)->firstOrFail();
        //or return view 
    return ['your code' => $promo->code, 'discount' => $promo->discount];
})->name('promo');

The Versions

03/03 2018

dev-master

9999999-dev

  Sources   Download

MIT

by Avatar bu4ak

laravel promocode

03/03 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

by Avatar bu4ak

laravel promocode