1. Go to this page and download the library: Download khaleds/voucher library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
khaleds / voucher example snippets
use Khaleds\Voucher\Seeder\VoucherImplementaionSeeder;
$this->call(VoucherImplementaionSeeder::class);
// $code : voucher code
// model : which model uses this voucher
// amount : the amount that you want to apply voucher on it
// return : voucher object if passed all conditions ex if not passed
VoucherFactory::get(string $code,Model $user,float $amount)->check()->get()
// if you pass 0 that mean the voucher applied and not used
// applay will add the model to voucher if passes the conditions and increment uses column
VoucherFactory::get(string $code,Model $user,float $amount)->check()->apply(1)->get()
VoucherFactory::get(string $code,Model $user,float $amount)->apply(bool $is_used, string $code, Model $model))
VoucherFactory::get(string $code,Model $user)->check()
// it tacks table name as a key and array of ids
->append(
[
"categories" => [1,2,3],
"products" => [1,2,3],
]
)
->apply(1)->get()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.