luqta/laravel-mongodb-passport
[2019] [Laravel v6] - 允许laravel/passport与jenssegers/laravel-mongodb一起使用的包
v1.0
2020-02-06 11:08 UTC
Requires
- php: ^7.1.3
- jenssegers/mongodb: ^3.6
- laravel/framework: ^6.0
- laravel/passport: ^8.0
- laravel/tinker: ^2.0
This package is not auto-updated.
Last update: 2024-09-28 08:43:32 UTC
README
一个服务提供者,用于添加对Laravel Passport和MongoDB的支持。
目录
安装
使用composer安装
composer require narwy/laravel-mongodb-passport
您需要让您的App\User
类继承自Narwy\Mongodb\Auth\User.php
,而不是默认的Illuminate\Foundation\Auth\User
。这个用户类继承自laravel-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版本兼容性
然后在config/app.php
中添加服务提供者
Narwy\Mongodb\MongodbPassportServiceProvider::class,
对于与Lumen的使用,请在bootstrap/app.php
中添加服务提供者。
$app->register(Narwy\Mongodb\MongodbPassportServiceProvider::class);
服务提供者将覆盖默认的Laravel Passport模型,以便使用MongoDB的Eloquent实现。除了在Laravel Passport和MongoDB中概述的之外,无需注册任何其他类或添加任何其他配置。