我尝试对由Laravel的make:auth命令创建的User类进行了为jenssegers/mongodb适配的修改

我试着用Laravel附带的Auth模块和Laravel的Mongodb操作包jenssegers/mongodb将数据库从MySQL转换为MongoDB。

只供参考

环境信息

laradock
PHP7.2
Laravel 5.6
jenssegers/mongodb 3.4
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
// ## ここが入れ替えの部分
//use Illuminate\Foundation\Auth\User as Authenticatable;
use Jenssegers\Mongodb\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * 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',
    ];
}


广告
将在 10 秒后关闭
bannerAds