mvjacobs/laravel-mongodb-passport

一个允许使用 laravel/passport 和 jenssegers/laravel-mongodb 的包

v2.0.0 2020-11-06 11:01 UTC

This package is not auto-updated.

Last update: 2024-09-22 04:34:34 UTC


README

Latest Stable Version Total Downloads

一个服务提供者,用于添加对 Laravel PassportMongoDB 的支持。

目录

安装

使用 Composer 安装

composer require designmynight/laravel-mongodb-passport

您需要让您的 App\User 类继承 DesignMyNight\Mongodb\Auth\User.php 而不是默认的 Illuminate\Foundation\Auth\User。这个用户类扩展了 larvel-mongodb eloquent 用户,并添加了所有标准和必需的认证和 Laravel Passport 特性。

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use DesignMyNight\Mongodb\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;
}

Laravel 版本兼容性

并在 config/app.php 中添加服务提供者

DesignMyNight\Mongodb\MongodbPassportServiceProvider::class,

对于与 Lumen 的使用,请在 bootstrap/app.php 中添加服务提供者。

$app->register(DesignMyNight\Mongodb\MongodbPassportServiceProvider::class);

服务提供者将覆盖默认的 Laravel Passport 模型,以便使用 MongoDB 的 Eloquent 实现。除了在 Laravel PassportMongoDB 中概述的那些之外,无需注册任何其他类或添加任何其他配置。