some stan

This commit is contained in:
2025-11-15 21:32:03 +05:00
parent c24f7cbac6
commit c94ac5d12d
8 changed files with 28 additions and 29 deletions

View File

@@ -22,11 +22,13 @@ class CurrencyRate extends Model
/**
* Get the user's first name.
*
* @return Attribute<string, void>
*/
protected function name(): Attribute
{
return Attribute::make(
get: fn () => $this->currency_from.'-'.$this->currency_to,
get: fn (): string => $this->currency_from.'-'.$this->currency_to,
);
}

View File

@@ -46,7 +46,7 @@ class OnlinePaymentRepository
/**
* Online payment
*/
protected ?OnlinePayment $onlinePayment;
protected OnlinePayment $onlinePayment;
/**
* If payment is successful
@@ -117,7 +117,7 @@ class OnlinePaymentRepository
/**
* Online payment
*/
public function onlinePayment(): ?OnlinePayment
public function onlinePayment(): OnlinePayment
{
return $this->onlinePayment;
}

View File

@@ -74,17 +74,18 @@ class PayVisaMasterPaymentAction
->helperText(sprintf('Iň ýokary möçberi: %s TMT', $max_value))
->live()
->afterStateUpdated(function (Set $set, ?string $state) use ($usd_to_tmt, $bankFee, $gbusFee) {
if (! $state || $state === 0 || $state === '') {
if (is_null($state) || $state == 0 || $state == '') {
$set('usd_rate', '');
return;
}
$state = floatval($state);
$usd_rate = floatval(number_format($state / $usd_to_tmt, 2, '.', ''));
$total_amount = floatval(number_format($state, 2, '.', '')) + $bankFee + $gbusFee;
$usd_rate = $state / $usd_to_tmt;
$total_amount = $state + $bankFee + $gbusFee;
$set('usd_rate', $usd_rate);
$set('total_amount', $total_amount);
$set('usd_rate', number_format($usd_rate, 2, '.', ''));
$set('total_amount', number_format($total_amount, 2, '.', ''));
}),
TextInput::make('usd_rate')

View File

@@ -21,9 +21,9 @@ use Spatie\MediaLibrary\InteractsWithMedia;
* @property string $email
* @property string $region
* @property string $address
* @property array $sender_datas
* @property array $payment_reciever
* @property array $documents
* @property array<string, string> $sender_datas
* @property array<string, string> $payment_reciever
* @property array<string, string> $documents
* @property string $status
* @property string $notes
* @property string $sender_full_name
@@ -77,7 +77,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
/**
* User
*
* @return BelongsTo<User, VisaMasterPaymentOrder>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
@@ -87,7 +87,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
/**
* Branch
*
* @return BelongsTo<Branch, VisaMasterPaymentOrder>
* @return BelongsTo<Branch, $this>
*/
public function branch(): BelongsTo
{
@@ -97,7 +97,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
/**
* Payment itmes
*
* @return HasMany<VisaMasterPaymentOrderItem, self>
* @return HasMany<VisaMasterPaymentOrderItem, $this>
*/
public function paymentItems(): HasMany
{

View File

@@ -38,7 +38,7 @@ class VisaMasterPaymentOrderItem extends Model
/**
* Parent order
*
* @return BelongsTo<VisaMasterPaymentOrder, self>
* @return BelongsTo<VisaMasterPaymentOrder, $this>
*/
public function parent(): BelongsTo
{
@@ -48,7 +48,7 @@ class VisaMasterPaymentOrderItem extends Model
/**
* Online payment
*
* @return BelongsTo<OnlinePayment, self>
* @return BelongsTo<OnlinePayment, $this>
*/
public function onlinePayment(): BelongsTo
{

View File

@@ -16,17 +16,17 @@ class VisaMasterPaymentOrderRepository
/**
* Bank fee
*/
public int|string|float $bankFee = 20;
public int|float $bankFee = 20;
/**
* Gbus fee
*/
public int|string|float $gbusFee = 3;
public int|float $gbusFee = 3;
/**
* Bank fee
*/
public function bankFee(): int|string|float
public function bankFee(): int|float
{
return $this->bankFee;
}
@@ -34,7 +34,7 @@ class VisaMasterPaymentOrderRepository
/**
* Gbus fee
*/
public function gbusFee(): int|string|float
public function gbusFee(): int|float
{
return $this->gbusFee;
}