update controllers logic
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\School;
|
||||
|
||||
use App\Services\ApplicationUrlService;
|
||||
use App\Services\EmailService;
|
||||
use App\Services\Notifications\UserNotificationDispatchService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -10,7 +11,8 @@ class PaymentEventService
|
||||
{
|
||||
public function __construct(
|
||||
private EmailService $emailService,
|
||||
private UserNotificationDispatchService $notifier
|
||||
private UserNotificationDispatchService $notifier,
|
||||
private ApplicationUrlService $urls,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -65,7 +67,7 @@ class PaymentEventService
|
||||
'installmentSeq' => (int) ($data['installment_seq'] ?? 1),
|
||||
'invoiceDiscount' => $invoiceDiscountRaw > 0 ? $fmtMoney($invoiceDiscountRaw) : null,
|
||||
'parentYearDiscountTotal' => $parentYearDiscountTotalRaw > 0 ? $fmtMoney($parentYearDiscountTotalRaw) : null,
|
||||
'portalLink' => url('/login'),
|
||||
'portalLink' => $this->urls->webLoginUrl(),
|
||||
'students' => $studentdata,
|
||||
];
|
||||
|
||||
@@ -165,7 +167,7 @@ class PaymentEventService
|
||||
'postBalance' => $postBalance,
|
||||
'createdAt' => $createdAt,
|
||||
'dueDate' => $dueDate !== '' ? $dueDate : null,
|
||||
'portalLink' => $data['portal_link'] ?? url('/login'),
|
||||
'portalLink' => $data['portal_link'] ?? $this->urls->webLoginUrl(),
|
||||
'invoiceLink' => $data['invoice_link'] ?? null,
|
||||
'students' => $studentdata,
|
||||
];
|
||||
@@ -214,10 +216,8 @@ class PaymentEventService
|
||||
|
||||
private function renderEmail(string $viewName, array $data, string $fallbackTitle): string
|
||||
{
|
||||
try {
|
||||
return view($viewName, $data, ['saveData' => true]);
|
||||
} catch (\Throwable $e) {
|
||||
return '<p>' . e($fallbackTitle) . '</p>';
|
||||
}
|
||||
Log::debug('Skipping Blade email template', ['view' => $viewName]);
|
||||
|
||||
return '<p>' . e($fallbackTitle) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user