1. Go to this page and download the library: Download aiarmada/filament-vouchers 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/ */
aiarmada / filament-vouchers example snippets
use AIArmada\FilamentVouchers\FilamentVouchersPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentVouchersPlugin::make(),
]);
}
// config/filament-vouchers.php
return [
// Navigation group for resources
'navigation' => [
'group' => 'Vouchers & Discounts'
],
// Default currency for monetary displays
'default_currency' => 'MYR',
// Table polling interval (seconds or null to disable)
'polling_interval' => 60,
// Resource navigation ordering
'resources' => [
'navigation_sort' => [
'vouchers' => 40,
'voucher_usage' => 41,
],
],
// Order resource for linking (set class-string or null)
'order_resource' => null,
// Owner types for multi-tenant voucher assignment
'owners' => [],
];
use AIArmada\FilamentVouchers\Extensions\CartVoucherActions;
protected function getHeaderActions(): array
{
return [
CartVoucherActions::applyVoucher(),
CartVoucherActions::showAppliedVouchers(),
];
}