1. Go to this page and download the library: Download furic/filament-redeem-codes 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/ */
furic / filament-redeem-codes example snippets
use Furic\FilamentRedeemCodes\FilamentRedeemCodesPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->plugins([
FilamentRedeemCodesPlugin::make(),
]);
}
// app/Enums/RewardType.php
namespace App\Enums;
use Furic\FilamentRedeemCodes\Contracts\RewardType as RewardTypeContract;
enum RewardType: string implements RewardTypeContract
{
case Coins = 'coins';
case Gems = 'gems';
case Energy = 'energy';
case Character = 'character';
case RemoveAds = 'remove_ads';
}
use Furic\FilamentRedeemCodes\Events\RedeemCodeRedeemed;
Event::listen(RedeemCodeRedeemed::class, function (RedeemCodeRedeemed $event) {
foreach ($event->code->rewards as $reward) {
// grant $reward->type / $reward->amount to auth()->user()
}
});