Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs on how to use SocialiteWasCalled[] in Laravel 11 #1176

Open
binaryfire opened this issue Mar 16, 2024 · 3 comments
Open

Docs on how to use SocialiteWasCalled[] in Laravel 11 #1176

binaryfire opened this issue Mar 16, 2024 · 3 comments

Comments

@binaryfire
Copy link

binaryfire commented Mar 16, 2024

Hi guys

I've just started a new Laravel 11 project and there's no longer an EventServiceProvider. What's the best way to use SocialiteWasCalled[] now? The current format doesn't work inside Event::listen().

Thanks!

@m3ntorsky
Copy link

m3ntorsky commented Mar 16, 2024

namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;

use \SocialiteProviders\Steam\Provider as SteamProvider;
use \SocialiteProviders\Discord\Provider as DiscordProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
            $event->extendSocialite('steam',SteamProvider::class);
            $event->extendSocialite('discord',DiscordProvider::class);
        });
        //
    }
}

Working fine.

@atymic
Copy link
Member

atymic commented Mar 17, 2024

Is Event::listen backwards compatible with older versions? If so, we can just update the docs to cover that.

@binaryfire
Copy link
Author

@M4TSKI Thanks! My point was that wasn't documented anywhere. I've never seen that syntax before.

@atymic Thanks for updating the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants