LoginSignup
2
2

More than 5 years have passed since last update.

Laravel make:authで作成されたUserクラスをjenssegers/mongodb用に修正して見た

Last updated at Posted at 2018-10-17

LaravelのMongodb操作パッケージjenssegers/mongodbを使って
Laravel同梱のAuthモジュールのデータベースをMongoDBに変えてみた。

ご参考程度で

環境情報

laradock
PHP7.2
Laravel 5.6
jenssegers/mongodb 3.4
App\User.php
<?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',
    ];
}


2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2