Bu biraz enteresan bir durumdur, çekirdek içinde gömülü bir mekanizmadır, şöyle yapabilirsiniz:
Yeni bir Notification oluşturun:
php artisan make:notification ResetPasswordNotification
İçeriği şu şekilde yapılandırın:
<?php
namespace App\Notifications;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ResetPasswordNotification extends Notification {
/**
* The password reset token.
*
* @var string
*/
public $token;
/**
* Create a notification instance.
*
* @param string $token
* @return void
*/
public function __construct($token, $user) {
$this->token = $token;
$this->user = $user;
}
/**
* Get the notification's channels.
*
* @param mixed $notifiable
* @return array|string
*/
public function via($notifiable) {
return ['mail'];
}
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable) {
return (new MailMessage)
->subject('Şifre Sıfırlama Bağlantısı')
->line('Şifre sıfırlama talebinde bulunduğunuz için bu e-postayı aldınız.')
->action('Şifremi Sıfırla', route('password.reset', $this->token) . '?email=' . $this->user->email)
->line('Eğer şifre sıfırlama talebinde bulunmadıysanız bu mesajı güvenle silebilirsiniz.');
}
}
User class içine bu dosyayı kullanan metodu ekleyin:
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPasswordNotification($token));
}
User class içinde
ResetPasswordNotification class'ını
use etmeyi unutmayın.
İşlem tamam!