phpstan 5 errors fixed
This commit is contained in:
@@ -43,7 +43,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
if (is_null($fields->payment_amount) || is_null($fields->usd_payment)) {
|
||||
if (! property_exists($fields, 'payment_amount') || ! property_exists($fields, 'usd_payment')) {
|
||||
return Action::modal('modal-response', [
|
||||
'title' => 'Töleg maglumatlary ýok!',
|
||||
'body' => 'Töleg maglumatlary girizilmedik',
|
||||
@@ -108,7 +108,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
$usd_to_tmt = CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value');
|
||||
$usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
|
||||
|
||||
$payment_warning_text = VisaMasterSettings::where('name', 'payment_warning_text')->first();
|
||||
|
||||
@@ -116,11 +116,11 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
return [];
|
||||
}
|
||||
|
||||
$max_value = number_format($usd_to_tmt->value * 250, 2);
|
||||
$max_value = number_format($usd_to_tmt * 250, 2);
|
||||
|
||||
return [
|
||||
Heading::make(Blade::render(<<<HTML
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt->value TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">Bankyň tutumy: 20 TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">GBÜS tutumy: 3 TMT</h3>
|
||||
HTML))->asHtml(),
|
||||
@@ -140,8 +140,8 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
->fullWidth()
|
||||
->readonly()
|
||||
->dependsOn('payment_amount', function ($field, $request, $formData) use ($usd_to_tmt) {
|
||||
if ($formData->payment_amount) {
|
||||
$field->setValue(number_format($formData->payment_amount / $usd_to_tmt->value, 2, '.', ''));
|
||||
if (property_exists($formData, 'payment_amount')) {
|
||||
$field->setValue(number_format($formData->payment_amount / $usd_to_tmt, 2, '.', ''));
|
||||
} else {
|
||||
$field->setValue('');
|
||||
}
|
||||
@@ -149,8 +149,8 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
|
||||
Hidden::make('usd_payment')
|
||||
->dependsOn('payment_amount', function ($field, $request, $formData) use ($usd_to_tmt) {
|
||||
if ($formData->payment_amount) {
|
||||
$field->setValue(number_format($formData->payment_amount / $usd_to_tmt->value, 2, '.', ''));
|
||||
if (property_exists($formData, 'payment_amount')) {
|
||||
$field->setValue(number_format($formData->payment_amount / $usd_to_tmt, 2, '.', ''));
|
||||
} else {
|
||||
$field->setValue('');
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
->fullWidth()
|
||||
->readonly()
|
||||
->dependsOn('payment_amount', function ($field, $request, $formData) {
|
||||
if (is_numeric($formData->payment_amount)) {
|
||||
if (property_exists($formData, 'payment_amount')) {
|
||||
$field->setValue(
|
||||
floatval(number_format($formData->payment_amount, 2, '.', '')) + 23
|
||||
);
|
||||
@@ -265,6 +265,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
// Condition 1: Check if today is the last day of the month
|
||||
if ($today->format('Y-m-d') === $lastDay->format('Y-m-d')) {
|
||||
info('check 1');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -276,6 +277,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
$forbiddenDays = ['Friday', 'Saturday', 'Sunday'];
|
||||
if (in_array($today->format('l'), $forbiddenDays)) {
|
||||
info('check 2');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -283,6 +285,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
// Condition 3: If the last day is Saturday, disallow Friday
|
||||
if ($lastDayOfWeek === 'Saturday' && $today->format('l') === 'Friday') {
|
||||
info('check 3');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user