<?php
namespace App\DiscountTypes;
use Lunar\Admin\Base\LunarPanelDiscountInterface;
use Lunar\DiscountTypes\AbstractDiscountType;
use Filament\Forms;
class MyCustomDiscountType extends AbstractDiscountType implements LunarPanelDiscountInterface
{
/**
* Return the schema to use in the Lunar admin panel
*/
public function lunarPanelSchema(): array
{
return [
Forms\Components\TextInput::make('data.my_field')
->label('My label')
->required(),
];
}
/**
* Mutate the model data before displaying it in the admin form.
*/
public function lunarPanelOnFill(array $data): array
{
// optionally do something with $data
return $data;
}
/**
* Mutate the form data before saving it to the discount model.
*/
public function lunarPanelOnSave(array $data): array
{
// optionally do something with $data
return $data;
}
}