update revisi
This commit is contained in:
@@ -27,6 +27,7 @@ use App\Rules\FileType;
|
||||
use App\Helpers\BudgetHelper;
|
||||
use App\Helpers\NotificationHelper;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Services\BrevoService;
|
||||
|
||||
class FormEntertainmentPresentationController extends Controller
|
||||
{
|
||||
@@ -232,15 +233,22 @@ class FormEntertainmentPresentationController extends Controller
|
||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||
|
||||
// Send bulk email
|
||||
$brevoService = app(BrevoService::class);
|
||||
foreach ($recipients as $recipient) {
|
||||
try {
|
||||
Mail::to($recipient)->send(new ExpenseCreated(
|
||||
$mail = new ExpenseCreated(
|
||||
$name,
|
||||
$expense_number,
|
||||
$tanggal,
|
||||
$total,
|
||||
$url
|
||||
));
|
||||
);
|
||||
|
||||
$response = $brevoService->expenseCreated($recipient, $name, $mail);
|
||||
|
||||
if (isset($response['success']) && $response['success'] === false) {
|
||||
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||
continue;
|
||||
@@ -394,16 +402,23 @@ class FormEntertainmentPresentationController extends Controller
|
||||
$url = route('forms.entertainment.view', $form->id);
|
||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||
|
||||
// // Send bulk email
|
||||
// Send bulk email
|
||||
$brevoService = app(BrevoService::class);
|
||||
foreach ($recipients as $recipient) {
|
||||
try {
|
||||
Mail::to($recipient)->send(new ExpenseApproved(
|
||||
$mail = new ExpenseApproved(
|
||||
$name,
|
||||
$expense_number,
|
||||
$tanggal,
|
||||
$total,
|
||||
$url
|
||||
));
|
||||
);
|
||||
|
||||
$response = $brevoService->expenseApproved($recipient, $name, $mail);
|
||||
|
||||
if (isset($response['success']) && $response['success'] === false) {
|
||||
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||
continue;
|
||||
@@ -478,16 +493,23 @@ class FormEntertainmentPresentationController extends Controller
|
||||
$url = route('forms.entertainment.view', $form->id);
|
||||
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||
|
||||
// // Send bulk email
|
||||
// Send bulk email
|
||||
$brevoService = app(BrevoService::class);
|
||||
foreach ($recipients as $recipient) {
|
||||
try {
|
||||
Mail::to($recipient)->send(new ExpenseApproved2(
|
||||
$mail = new ExpenseApproved2(
|
||||
$name,
|
||||
$expense_number,
|
||||
$tanggal,
|
||||
$total,
|
||||
$url
|
||||
));
|
||||
);
|
||||
|
||||
$response = $brevoService->expenseApproved2($recipient, $name, $mail);
|
||||
|
||||
if (isset($response['success']) && $response['success'] === false) {
|
||||
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||
continue;
|
||||
@@ -571,15 +593,22 @@ class FormEntertainmentPresentationController extends Controller
|
||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||
|
||||
// Send bulk email
|
||||
$brevoService = app(BrevoService::class);
|
||||
foreach ($recipients as $recipient) {
|
||||
try {
|
||||
Mail::to($recipient)->send(new FinalApprove(
|
||||
$mail = new FinalApprove(
|
||||
$name,
|
||||
$expense_number,
|
||||
$tanggal,
|
||||
$total,
|
||||
$url
|
||||
));
|
||||
);
|
||||
|
||||
$response = $brevoService->expenseFinalApproved($recipient, $name, $mail);
|
||||
|
||||
if (isset($response['success']) && $response['success'] === false) {
|
||||
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||
continue;
|
||||
@@ -629,15 +658,22 @@ class FormEntertainmentPresentationController extends Controller
|
||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||
|
||||
// Send bulk email
|
||||
$brevoService = app(BrevoService::class);
|
||||
foreach ($recipients as $recipient) {
|
||||
try {
|
||||
Mail::to($recipient)->send(new ExpenseRejected(
|
||||
$mail = new ExpenseRejected(
|
||||
$name,
|
||||
$expense_number,
|
||||
$tanggal,
|
||||
$total,
|
||||
$url
|
||||
));
|
||||
);
|
||||
|
||||
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||
|
||||
if (isset($response['success']) && $response['success'] === false) {
|
||||
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user