feat: Send cheerful notification to super admins upon new user registration.
This commit is contained in:
parent
098d3d0df2
commit
ee39b1f33a
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Filament\Pages\Auth;
|
namespace App\Filament\Pages\Auth;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Manage\Partners\PartnerResource;
|
||||||
|
use App\Filament\Support\CheerfulNotification;
|
||||||
|
use App\Notifications\BroadcastNotification;
|
||||||
|
use Filament\Actions\Action;
|
||||||
use Filament\Auth\Pages\Register;
|
use Filament\Auth\Pages\Register;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
@ -67,6 +71,26 @@ protected function handleRegistration(array $data): Model
|
|||||||
$user = $this->getUserModel()::create($data);
|
$user = $this->getUserModel()::create($data);
|
||||||
$user->assignRole('Perusahaan');
|
$user->assignRole('Perusahaan');
|
||||||
|
|
||||||
|
CheerfulNotification::success(
|
||||||
|
'Warga Baru Nih! 👋🎉',
|
||||||
|
"{$user->name} baru saja mendaftar. Yuk cek kelengkapannya! 🚀"
|
||||||
|
)
|
||||||
|
->send();
|
||||||
|
|
||||||
|
$this->getUserModel()::superAdmin()
|
||||||
|
->get()
|
||||||
|
->each(function ($admin) use ($user): void {
|
||||||
|
$admin->notify(new BroadcastNotification([
|
||||||
|
'title' => 'Warga Baru Nih! 👋🎉',
|
||||||
|
'body' => "Halo Admin! {$user->name} baru saja mendaftar. Yuk cek kelengkapannya! 🚀",
|
||||||
|
'action' => [
|
||||||
|
Action::make('view')
|
||||||
|
->label('Lihat')
|
||||||
|
->url(PartnerResource::getUrl('view', ['record' => $user->id])),
|
||||||
|
],
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user