rector: arrrrr
This commit is contained in:
@@ -8,29 +8,32 @@ use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Laravel\Telescope\TelescopeServiceProvider;
|
||||
use SocialiteProviders\Authentik\Provider;
|
||||
use SocialiteProviders\Manager\SocialiteWasCalled;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
if ($this->app->environment('local')) {
|
||||
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
||||
$this->app->register(TelescopeServiceProvider::class);
|
||||
}
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
|
||||
$event->extendSocialite('authentik', \SocialiteProviders\Authentik\Provider::class);
|
||||
Event::listen(function (SocialiteWasCalled $socialiteWasCalled) {
|
||||
$socialiteWasCalled->extendSocialite('authentik', Provider::class);
|
||||
});
|
||||
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
|
||||
|
||||
Password::defaults(function () {
|
||||
$rule = Password::min(8);
|
||||
$password = Password::min(8);
|
||||
|
||||
return $this->app->isProduction()
|
||||
? $rule->mixedCase()->letters()->numbers()->symbols()
|
||||
: $rule;
|
||||
? $password->mixedCase()->letters()->numbers()->symbols()
|
||||
: $password;
|
||||
});
|
||||
|
||||
Http::macro('github', function (string $api_url, ?string $github_access_token = null) {
|
||||
@@ -40,11 +43,11 @@ class AppServiceProvider extends ServiceProvider
|
||||
'Accept' => 'application/vnd.github.v3+json',
|
||||
'Authorization' => "Bearer $github_access_token",
|
||||
])->baseUrl($api_url);
|
||||
} else {
|
||||
return Http::withHeaders([
|
||||
'Accept' => 'application/vnd.github.v3+json',
|
||||
])->baseUrl($api_url);
|
||||
}
|
||||
|
||||
return Http::withHeaders([
|
||||
'Accept' => 'application/vnd.github.v3+json',
|
||||
])->baseUrl($api_url);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user