Winter Core 扩展 Laravel Auth

1.0.1 2022-01-09 20:58 UTC

This package is auto-updated.

Last update: 2024-09-26 20:36:55 UTC


README

这允许您在 WinterCMS 中使用 Laravel 的核心认证

新包

请考虑使用此代替,以避免手动更改您的文件: https://github.com/Teranode/wn-application-core-plugin

如何安装

composer require winter-bridge/bridge

php artisan vendor:publish --tag=winter-bridge-config - 这将在 congfig/ 文件夹中创建一个 auth.php 配置文件,包含 Winter 的设置

bootstrap/app.php 中更改

$app = new Winter\Storm\Foundation\Application(
    realpath(__DIR__.'/../')
);

$app = new Winter\Bridge\Foundation\Application(
    realpath(__DIR__.'/../')
);

然后更改

$app->singleton(
    Illuminate\Contracts\Http\Kernel::class,
    Winter\Storm\Foundation\Http\Kernel::class
);

$app->singleton(
    Illuminate\Contracts\Http\Kernel::class,
    Winter\Bridge\Foundation\Http\Kernel::class
);

接下来在 config/app.php 中,在 providers 部分 之后 System\SystemProvider

Illuminate\Auth\AuthServiceProvider::class,
Winter\Bridge\Auth\AuthServiceProvider::class,

现在如果您想使用该认证,您可以在用户插件中进行

Auth::extend('winter', function($app, $name, array $config)
{
    $guard = new \Winter\User\Classes\AuthManager;
    return $guard;
});

(如果您想,也可以添加 Gate 别名)

之后,该包应该基本上作为一个在 Laravel 认证之上,同时保留 Winter 的功能的层。