定制 petnetwebapps/user-authentication 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

petnetwebapps/user-authentication

Composer 安装命令:

composer require petnetwebapps/user-authentication

包简介

Customized authentication for petnet web apps

README 文档

README

  • Laravel 5.8
  • PHP 7.2

Instructions

$ composer require petnetwebapps/user-authentication

Add the provider at config/app.php

'providers' => [
    Petnet\Auth\PetnetServiceProvider::class

Publish the config file at

php artisan vendor:publish --provider="Petnet\Auth\PetnetServiceProvider"

Delete your user migrations in database/migrations directory

Then run the command:

$ php artisan migrate
$ php artisan passport:install

In your app/Http/Middlewares/VerifyCsrfToken.php, please except the webhook routes by typing

protected $except = [
    'webhooks/*'
];

Register this routes at routes/web.php

Route::webhooks('/webhooks/user', '/webhooks/user');
Route::webhooks('/webhooks/update-user', '/webhooks/update-user');
Route::webhooks('/webhooks/delete-user', '/webhooks/delete-user');

Then add the Petnet\Auth\Concerns\CanVerifyUser.php in app/User.php

Modify the app/User.php

<?php

namespace App;

use Petnet\Auth\Models\User as Authenticatable;
class User extends Authenticatable
{

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

}

Now you can access the authentication routes built via hookified

RouteMethodDescription
/api/loginPOSTLogin the user
/api/logoutPOSTLogout the user
/api/email/verify/{id}/{hash}GETGet the email and the verify email token
/api/password/emailPOSTSend reset password link
/api/email/resendPOSTResend email verification
/api/password/reset/{token}GETReturn the forgot password token
/api/password/resetPOSTReset the password
/api/email/verifyGETCheck if account is verified

You can seed your dummy users via factories by typing

$ php artisan tinker 
>> factory(Petnet\Auth\Models\Role::class, 10)->create();
>> factory(Petnet\Auth\Models\User::class, 10)->create();

You can also modify the default username of login via config/user-auth.php

   'username' => 'employee_id',

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固