Log in to Socialink
@if(session('success'))
{{ session('success') }}
@endif
@if(session('error'))
{{ session('error') }}
@endif
@if(session('status'))
{{ session('status') }}
@endif
@php
$settings = \App\Models\Setting::getSettings();
$settingAliases = [
'chck-facebookLogin' => 'facebookLogin',
'chck-VkontakteLogin' => 'VkontakteLogin',
'chck-googleLogin' => 'googleLogin',
'chck-twitterLogin' => 'twitterLogin',
'chck-linkedinLogin' => 'linkedinLogin',
'chck-instagramLogin' => 'instagramLogin',
'chck-qqLogin' => 'qqLogin',
'chck-WeChatLogin' => 'WeChatLogin',
'chck-DiscordLogin' => 'DiscordLogin',
'chck-MailruLogin' => 'MailruLogin',
'chck-OkLogin' => 'OkLogin',
'chck-tiktok_login' => 'tiktok_login',
'chck-wordpress_login' => 'wordpressLogin',
'facebookAppId' => 'facebook_client_id',
'facebookAppKey' => 'facebook_client_secret',
];
$resolveSetting = static function (string $key) use (&$settings, $settingAliases) {
$value = $settings[$key] ?? null;
if (($value === null || $value === '') && isset($settingAliases[$key])) {
$aliasKey = $settingAliases[$key];
$value = $settings[$aliasKey] ?? null;
}
if ($value === null || $value === '') {
$value = setting($key);
if ($value !== null && $value !== '') {
$settings[$key] = $value;
} elseif (isset($settingAliases[$key])) {
$aliasKey = $settingAliases[$key];
$aliasValue = setting($aliasKey);
if ($aliasValue !== null && $aliasValue !== '') {
$settings[$aliasKey] = $aliasValue;
$value = $aliasValue;
}
}
}
return $value;
};
$toggleEnabled = static function ($value): bool {
if (is_bool($value)) {
return $value;
}
if (is_numeric($value)) {
return (bool) ((int) $value);
}
$normalized = strtolower((string) $value);
return in_array($normalized, ['1', 'true', 'yes', 'on'], true);
};
$socialProviders = [
'facebook' => [
'label' => 'Continue with Facebook',
'icon' => 'fab fa-facebook-f',
'class' => 'facebook-btn',
'toggle' => 'chck-facebookLogin',
'credentials' => ['facebookAppId', 'facebookAppKey'],
],
'google' => [
'label' => 'Continue with Google',
'icon' => 'fab fa-google',
'class' => 'google-btn',
'toggle' => 'chck-googleLogin',
'credentials' => ['googleAppId', 'googleAppKey'],
],
'twitter' => [
'label' => 'Continue with Twitter',
'icon' => 'fab fa-twitter',
'class' => 'twitter-btn',
'toggle' => 'chck-twitterLogin',
'credentials' => ['twitterAppId', 'twitterAppKey'],
],
'linkedin' => [
'label' => 'Continue with LinkedIn',
'icon' => 'fab fa-linkedin-in',
'class' => 'linkedin-btn',
'toggle' => 'chck-linkedinLogin',
'credentials' => ['linkedinAppId', 'linkedinAppKey'],
],
'vkontakte' => [
'label' => 'Continue with VKontakte',
'icon' => 'fab fa-vk',
'class' => 'vkontakte-btn',
'toggle' => 'chck-VkontakteLogin',
'credentials' => ['VkontakteAppId', 'VkontakteAppKey'],
],
'instagram' => [
'label' => 'Continue with Instagram',
'icon' => 'fab fa-instagram',
'class' => 'instagram-btn',
'toggle' => 'chck-instagramLogin',
'credentials' => ['instagramAppId', 'instagramAppkey'],
],
'qq' => [
'label' => 'Continue with QQ',
'icon' => 'fab fa-qq',
'class' => 'qq-btn',
'toggle' => 'chck-qqLogin',
'credentials' => ['qqAppId', 'qqAppkey'],
],
'wechat' => [
'label' => 'Continue with WeChat',
'icon' => 'fab fa-weixin',
'class' => 'wechat-btn',
'toggle' => 'chck-WeChatLogin',
'credentials' => ['WeChatAppId', 'WeChatAppkey'],
],
'discord' => [
'label' => 'Continue with Discord',
'icon' => 'fab fa-discord',
'class' => 'discord-btn',
'toggle' => 'chck-DiscordLogin',
'credentials' => ['DiscordAppId', 'DiscordAppkey'],
],
'mailru' => [
'label' => 'Continue with Mail.ru',
'icon' => 'fas fa-envelope',
'class' => 'mailru-btn',
'toggle' => 'chck-MailruLogin',
'credentials' => ['MailruAppId', 'MailruAppkey'],
],
'odnoklassniki' => [
'label' => 'Continue with OK.ru',
'icon' => 'fab fa-odnoklassniki',
'class' => 'odnoklassniki-btn',
'toggle' => 'chck-OkLogin',
'credentials' => ['OkAppId', 'OkAppSecretkey', 'OkAppPublickey'],
],
'tiktok' => [
'label' => 'Continue with TikTok',
'icon' => 'fab fa-tiktok',
'class' => 'tiktok-btn',
'toggle' => 'chck-tiktok_login',
'credentials' => ['tiktok_client_key', 'tiktok_client_secret'],
],
'wordpress' => [
'label' => 'Continue with WordPress',
'icon' => 'fab fa-wordpress',
'class' => 'wordpress-btn',
'toggle' => 'chck-wordpress_login',
'credentials' => ['WordPressAppId', 'WordPressAppkey'],
],
];
$availableSocialProviders = collect($socialProviders)->filter(function ($meta) use ($resolveSetting, $toggleEnabled) {
$toggleValue = $resolveSetting($meta['toggle']);
if (!$toggleEnabled($toggleValue)) {
return false;
}
foreach ($meta['credentials'] as $settingKey) {
$credentialValue = $resolveSetting($settingKey);
if ($credentialValue === null || $credentialValue === '') {
return false;
}
}
return true;
});
@endphp
@if($availableSocialProviders->isNotEmpty())
@endif
or