这篇文章主要介绍了laravel框架邮箱认证实现方法,结合实例形式详细分析了laravel框架邮箱认证功能的具体实现步骤及相关操作技巧,需要的朋友可以参考下
本文实例讲述了laravel框架邮箱认证实现方法。分享给大家供大家参考,具体如下:
修改 User 模型,将 Laravel 自带的邮箱认证功能集成到我们的程序中
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\MustVerifyEmail as MustVerifyEmailTrait;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail as MustVerifyEmailContract;
class User extends Authenticatable implements MustVerifyEmailContract
{
use Notifiable, MustVerifyEmailTrait;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}