PHP code example of sorry510 / auth

1. Go to this page and download the library: Download sorry510/auth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sorry510 / auth example snippets


php artisan vendor:publish --tag=auth
php artisan vendor:publish --tag=auth-migrations

php artisan migrate



namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
  ...
    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'permission' => \App\Http\Middleware\Permission::class, // 权限中间件,必须放到 auth:sanctum 后面执行
    ];
}

php artisan swagger 模块名称 // 生成swagger接口文档
php artisan swagger 模块名称 -r api.php // 生成swagger接口文档,同时同步生成路由文件
php artisan route:sync // 根据 openapi.json 对路由文件同步更新
php artisan route:permission // 根据路由文件同步权限列表