55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Resep;
|
|
use Illuminate\Auth\Notifications\ResetPassword;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Kustomisasi Email Reset Password
|
|
ResetPassword::toMailUsing(function (object $notifiable, string $token) {
|
|
return (new MailMessage)
|
|
->subject('Pemberitahuan Reset Password - MedData')
|
|
->greeting('Halo ' . $notifiable->name . ',')
|
|
->line('Anda menerima email ini karena kami menerima permintaan reset password untuk akun Anda.')
|
|
->action('Reset Password Sekarang', url(route('password.reset', [
|
|
'token' => $token,
|
|
'email' => $notifiable->getEmailForPasswordReset(),
|
|
], false)))
|
|
->line('Link reset password ini akan kadaluarsa dalam ' . config('auth.passwords.'.config('auth.defaults.passwords').'.expire') . ' menit.')
|
|
->line('Jika Anda tidak melakukan permintaan reset password, abaikan email ini.')
|
|
->salutation('Salam hormat, Tim MedData Puskesmas');
|
|
});
|
|
|
|
// Share unread resep count with sidebar for notification badge
|
|
View::composer('components.sidebar', function ($view) {
|
|
$unreadResepCount = 0;
|
|
|
|
if (auth()->check() && auth()->user()->isApoteker()) {
|
|
// Show unread resep count only for apoteker
|
|
$unreadResepCount = Resep::unread()->count();
|
|
}
|
|
|
|
$view->with('unreadResepCount', $unreadResepCount);
|
|
});
|
|
}
|
|
}
|
|
|