Winter Core Extending Laravel Auth

1.0.1 2022-01-09 20:58 UTC

This package is auto-updated.

Last update: 2024-11-26 20:59:14 UTC


README

This will allow you to use Laravel's core auth with WinterCMS

New Package

Please Consider using this instead to avoid having to manually change your files: https://github.com/Teranode/wn-application-core-plugin

How to install

composer require winter-bridge/bridge

php artisan vendor:publish --tag=winter-bridge-config - this will create an auth.php config file in the congfig/ folder with settings for winter

In bootstrap/app.php change:

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

to

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

and change:

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

to

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

Next in config/app.php add in the providers after System\SystemProvider:

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

now if you want to use said auth you'd do so in the user plugin:

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

(you can also add the Gate alias if you want)

After that the package should essentially act as a layer over Laravel's auth while retaining winter's functions.