61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class ForgotPasswordMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
|
|
public string $url;
|
|
public ?string $userName;
|
|
|
|
public function __construct(string $url, ?string $userName = null)
|
|
{
|
|
$this->url = $url;
|
|
$this->userName = $userName;
|
|
}
|
|
|
|
public function build()
|
|
{
|
|
$app = config('app.name');
|
|
$expires = config('auth.passwords.' . config('auth.defaults.passwords') . '.expire');
|
|
|
|
$logoName = 'logo_sidakdesa'; // Content-ID yang kita tentukan sendiri
|
|
$logoPath = public_path('assets/images/sidak-desa.jpg');
|
|
|
|
$hasLogo = is_file($logoPath);
|
|
|
|
if ($hasLogo) {
|
|
$this->withSymfonyMessage(function ($message) use ($logoPath, $logoName) {
|
|
// Pastikan content-type benar (jpeg/png sesuai filemu)
|
|
$message->embedFromPath($logoPath, $logoName, 'image/jpeg');
|
|
});
|
|
}
|
|
|
|
// Fallback URL (untuk produksi HARUS https & publik)
|
|
$logoUrl = asset('assets/images/sidak-desa.jpg');
|
|
|
|
return $this->subject("Reset Kata Sandi - {$app}")
|
|
->view('emails.forgot-password', [
|
|
'url' => $this->url,
|
|
'userName' => $this->userName,
|
|
'appName' => $app,
|
|
'expires' => $expires,
|
|
'hasLogo' => $hasLogo,
|
|
'logoSrc' => $hasLogo ? "cid:{$logoName}" : $logoUrl, // <-- langsung bentuk "cid:..."
|
|
'brand' => [
|
|
'primary' => '#1f7a8c',
|
|
'text' => '#2b2b2b',
|
|
'muted' => '#6b7280',
|
|
'bg' => '#edf2f7',
|
|
'card' => '#ffffff',
|
|
],
|
|
]);
|
|
}
|
|
}
|