feat(push notification): menambahkan di register
This commit is contained in:
parent
5fa0944811
commit
a363324e7e
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -142,10 +142,10 @@ public function auth()
|
||||
'type' => PointRecordType::TIER,
|
||||
]);
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
$user->assignRole('Customer');
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
$user->sendEmailVerificationNotification();
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user