jonsutherland/laravel-mongodb-passport

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

dev-master 2023-07-25 13:04 UTC

This package is auto-updated.

Last update: 2024-09-25 15:42:58 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 中概述的之外,不需要注册任何其他类或添加任何其他配置。