daijiro of Techpit
3/11/2020 - 9:39 AM

User.php

<?php

namespace App;

//==========ここから追加==========
use App\Mail\BareMail;
use App\Notifications\PasswordResetNotification;
//==========ここまで追加==========
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    // 略
    
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

    //==========ここから追加==========
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new PasswordResetNotification($token, new BareMail()));
    }
    //==========ここまで追加==========
}