steveporter92/laravel-mongodb-passport

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

v0.0.2-alpha 2019-12-18 20:31 UTC

This package is auto-updated.

Last update: 2024-09-19 06:41:20 UTC


README

Latest Stable Version Total Downloads

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

目录

安装

使用composer安装

composer require steveporter92/laravel-mongodb-passport

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

<?php

namespace App;

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

class User extends Authenticatable
{
    use Notifiable;
}

Laravel版本兼容性

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

StevePorter92\Mongodb\MongodbPassportServiceProvider::class,

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

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

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