added logs in edit transporter page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 19s
Laravel Larastan / larastan (pull_request) Failing after 3m47s
Laravel Pint / pint (pull_request) Failing after 3m59s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 19s
Laravel Larastan / larastan (pull_request) Failing after 3m47s
Laravel Pint / pint (pull_request) Failing after 3m59s
This commit is contained in:
@@ -12,6 +12,7 @@ use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class EditRfqTransporterBid extends EditRecord
|
||||
{
|
||||
@@ -38,12 +39,24 @@ class EditRfqTransporterBid extends EditRecord
|
||||
|
||||
$userNames = $spotRate->user_name;
|
||||
|
||||
Log::info('User names from spot rate', [
|
||||
'user_name_raw' => $spotRate->user_name,
|
||||
]);
|
||||
|
||||
if (!is_array($userNames)) {
|
||||
Log::warning('user_name is not array, resetting', [
|
||||
'user_name' => $userNames,
|
||||
]);
|
||||
$userNames = [];
|
||||
}
|
||||
|
||||
|
||||
$users = User::whereIn('name', $userNames)->get();
|
||||
|
||||
Log::info('Matched users', [
|
||||
'count' => $users->count(),
|
||||
'user_ids' => $users->pluck('id'),
|
||||
]);
|
||||
|
||||
// $recipients = User::role(['Super Admin', 'Rfq Supervisor', 'TransporterBid Employee'])->get();
|
||||
|
||||
@@ -92,7 +105,17 @@ class EditRfqTransporterBid extends EditRecord
|
||||
// }
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
Log::info('Checking push subscription for user', [
|
||||
'user_id' => $user->id,
|
||||
'name' => $user->name,
|
||||
'subscription_count' => $user->pushSubscriptions()->count(),
|
||||
]);
|
||||
if ($user->pushSubscriptions()->exists()) {
|
||||
|
||||
Log::info('Sending push notification', [
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
$user->notify(
|
||||
new PushAlertNotification(
|
||||
'Rank Updated',
|
||||
@@ -100,6 +123,11 @@ class EditRfqTransporterBid extends EditRecord
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
Log::warning('User has NO push subscription', [
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user