ctrlpanel/app/Settings/CouponSettings.php

58 lines
1.7 KiB
PHP
Raw Normal View History

2023-05-17 16:17:51 +00:00
<?php
namespace App\Settings;
use Spatie\LaravelSettings\Settings;
class CouponSettings extends Settings
{
public ?int $max_uses_per_user;
2023-05-18 19:51:10 +00:00
public ?bool $delete_coupon_on_expires;
public ?bool $delete_coupon_on_uses_reached;
2023-05-17 16:17:51 +00:00
public static function group(): string
{
return 'coupon';
}
/**
* Summary of validations array
* @return array<string, string>
*/
public static function getValidations()
{
return [
2023-05-18 19:51:10 +00:00
'max_uses_per_user' => 'required|integer',
'delete_coupon_on_expires' => 'required|boolean',
'delete_coupon_on_uses_reached' => 'required|boolean',
2023-05-17 16:17:51 +00:00
];
}
/**
* Summary of optionInputData array
* Only used for the settings page
* @return array<array<'type'|'label'|'description'|'options', string|bool|float|int|array<string, string>>>
*/
public static function getOptionInputData()
{
return [
"category_icon" => "fas fa-ticket-alt",
'max_uses_per_user' => [
'label' => 'Max Uses Per User',
'type' => 'number',
2023-05-18 19:51:10 +00:00
'description' => 'Maximum number of uses that a user can make of the same coupon.'
],
'delete_coupon_on_expires' => [
'label' => 'Auto Delete Expired Coupons',
2023-05-18 19:51:10 +00:00
'type' => 'boolean',
'description' => 'Automatically deletes the coupon if it expires.'
],
'delete_coupon_on_uses_reached' => [
'label' => 'Delete Coupon When Max Uses Reached',
'type' => 'boolean',
'description' => 'Delete a coupon as soon as its maximum usage is reached.'
2023-05-17 16:17:51 +00:00
]
];
}
}