narwy/laravel-mongodb-passport

[2019] [Laravel v6] - 允许使用 jenssegers/laravel-mongodb 与 laravel/passport 的包

2.0.2 2019-12-09 11:17 UTC

This package is auto-updated.

Last update: 2020-01-09 11:29:32 UTC


README

Latest Stable Version Total Downloads

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

目录

安装

使用 composer 安装

composer require narwy/laravel-mongodb-passport

您需要将您的 App\User 类扩展为 Narwy\Mongodb\Auth\User.php 而不是默认的 Illuminate\Foundation\Auth\User。此用户类扩展了 larvel-mongodb eloquent 用户,并添加了所有标准和必需的认证以及 Laravel Passport 特性。

<?php

namespace App;

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

class User extends Authenticatable
{
    use Notifiable;
}

Laravel 版本兼容性

Laravel Passport
5.5.x 4.0.x, 5.0.x, 6.0.x, 7.0.x 1.1.x
5.6.x 4.0.x, 5.0.x, 6.0.x, 7.0.x 1.1.x
5.7.x 4.0.x, 5.0.x, 6.0.x, 7.0.x 1.1.x
5.8.x 4.0.x, 5.0.x, 6.0.x, 7.0.x 1.1.x
6.0.x 7.5.x 2.x.x
6.1.x 7.5.x 2.x.x
6.2.x 7.5.x 2.x.x
6.3.x 7.5.x 2.x.x
6.x 7.5.x 2.x.x

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

Narwy\Mongodb\MongodbPassportServiceProvider::class,

对于与 Lumen 一起使用,请在 bootstrap/app.php 中添加服务提供程序。

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

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