october-bridge / bridge
1.0.1
2022-01-09 20:58 UTC
This package is auto-updated.
Last update: 2022-01-26 14:33:30 UTC
README
这将允许您使用 Laravel 的核心认证功能与 WinterCMS 一起使用
新包
请考虑使用此包,以避免手动更改文件: https://github.com/Teranode/wn-application-core-plugin
如何安装
composer require winter-bridge/bridge
php artisan vendor:publish --tag=winter-bridge-config
- 这将在 congfig/
文件夹中创建一个带有 winter 设置的 auth.php
配置文件
在 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
中,在 System\SystemProvider
之后添加到 providers
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 的功能。