79 lines
2.3 KiB
PHP
79 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Listeners\StripeEventListener;
|
|
use App\Socialite\InstagramProvider;
|
|
use App\Socialite\LinkedInPageExtendSocialite;
|
|
use Carbon\CarbonImmutable;
|
|
use Illuminate\Support\Facades\Date;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Event;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Validation\Rules\Password;
|
|
use Laravel\Cashier\Events\WebhookReceived;
|
|
use Laravel\Socialite\Facades\Socialite;
|
|
use SocialiteProviders\Facebook\FacebookExtendSocialite;
|
|
use SocialiteProviders\LinkedIn\LinkedInExtendSocialite;
|
|
use SocialiteProviders\Manager\SocialiteWasCalled;
|
|
use SocialiteProviders\TikTok\TikTokExtendSocialite;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
$this->configureDefaults();
|
|
$this->configureSocialite();
|
|
$this->configureStripeWebhooks();
|
|
}
|
|
|
|
protected function configureStripeWebhooks(): void
|
|
{
|
|
Event::listen(WebhookReceived::class, StripeEventListener::class);
|
|
}
|
|
|
|
protected function configureSocialite(): void
|
|
{
|
|
// Instagram Business Login
|
|
Socialite::extend('instagram', function ($app) {
|
|
$config = $app['config']['services.instagram'];
|
|
|
|
return Socialite::buildProvider(InstagramProvider::class, $config);
|
|
});
|
|
|
|
Event::listen(SocialiteWasCalled::class, FacebookExtendSocialite::class);
|
|
Event::listen(SocialiteWasCalled::class, LinkedInExtendSocialite::class);
|
|
Event::listen(SocialiteWasCalled::class, LinkedInPageExtendSocialite::class);
|
|
Event::listen(SocialiteWasCalled::class, TikTokExtendSocialite::class);
|
|
}
|
|
|
|
protected function configureDefaults(): void
|
|
{
|
|
Date::use(CarbonImmutable::class);
|
|
|
|
DB::prohibitDestructiveCommands(
|
|
app()->isProduction(),
|
|
);
|
|
|
|
Password::defaults(fn (): ?Password => app()->isProduction()
|
|
? Password::min(12)
|
|
->mixedCase()
|
|
->letters()
|
|
->numbers()
|
|
->symbols()
|
|
->uncompromised()
|
|
: null
|
|
);
|
|
}
|
|
}
|