feat(push notification): menambahkan di register

This commit is contained in:
Yoga Pangestu 2025-11-16 15:59:21 +07:00
parent 5fa0944811
commit a363324e7e
2 changed files with 14 additions and 2 deletions

View File

@ -2,7 +2,10 @@
namespace App\Livewire\Auth;
use App\Jobs\StorePushNotification;
use App\Livewire\Forms\Auth\RegisterForm;
use App\Models\PushNotification;
use App\Models\User;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Illuminate\Support\Str;
@ -80,6 +83,15 @@ public function register()
$this->toast('Selamat, akun Anda berhasil didaftarkan. Silakan periksa email Anda untuk melakukan verifikasi.');
$userIds = User::role(['Developer', 'Owner'])->pluck('id')->toArray();
StorePushNotification::dispatch(
PushNotification::whereIn('user_id', $userIds)->get(),
[
'title' => 'Member Baru',
'body' => 'Seorang member baru baru saja bergabung. Cek selengkapnya di aplikasi',
],
);
$this->redirectIntended('/customer/dashboard/overview', navigate: true);
}

View File

@ -142,10 +142,10 @@ public function auth()
'type' => PointRecordType::TIER,
]);
auth()->login($user);
$user->assignRole('Customer');
auth()->login($user);
$user->sendEmailVerificationNotification();
});
}