ifnex/04_Laravel/app/Enums/PaymentGateway.php

50 lines
1.1 KiB
PHP

<?php
namespace App\Enums;
enum PaymentGateway: string
{
case ZARINPAL = 'zarinpal';
case WALLET = 'wallet';
case MANUAL = 'manual';
case SYSTEM = 'system';
/**
* لیبل فارسی
*/
public function label(): string
{
return match($this) {
self::ZARINPAL => 'زرین‌پال',
self::WALLET => 'کیف پول',
self::MANUAL => 'دستی (ادمین)',
self::SYSTEM => 'سیستم',
};
}
/**
* آیکون
*/
public function icon(): string
{
return match($this) {
self::ZARINPAL => 'heroicon-o-credit-card',
self::WALLET => 'heroicon-o-wallet',
self::MANUAL => 'heroicon-o-pencil-square',
self::SYSTEM => 'heroicon-o-cog-6-tooth',
};
}
/**
* رنگ badge
*/
public function color(): string
{
return match($this) {
self::ZARINPAL => 'primary',
self::WALLET => 'success',
self::MANUAL => 'warning',
self::SYSTEM => 'gray',
};
}
}