HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/whatsapp.dmstech.online/app/Services/SocialLoginService.php
<?php

namespace App\Services;

use App\Models\Setting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use DB;
use Socialite;

class SocialLoginService
{
    public static function makeGoogleDriver()
    {
        $metadata = Setting::where('key', 'google_login')->first()->value;
        $metadata = json_decode($metadata);
        $app_id = $metadata !== false ? isset($metadata->client_id) ?  $metadata->client_id : '' : '';
        $app_secret = $metadata !== false ? isset($metadata->client_secret) ? $metadata->client_secret : '' : '';

        $config = [
            'client_id' => $app_id,
            'client_secret' => $app_secret,
            'redirect' => url('google/callback'),
        ];

        return Socialite::buildProvider('\Laravel\Socialite\Two\GoogleProvider', $config);
    }

    public static function makeFacebookDriver()
    {
        $metadata = Setting::where('key', 'facebook_login')->first()->value;
        $metadata = json_decode($metadata);
        $app_id = $metadata !== false ? isset($metadata->client_id) ?  $metadata->client_id : '' : '';
        $app_secret = $metadata !== false ? isset($metadata->client_secret) ? $metadata->client_secret : '' : '';

        $config = [
            'client_id' => $app_id,
            'client_secret' => $app_secret,
            'redirect' => url('facebook/callback'),
        ];

        return Socialite::buildProvider('\Laravel\Socialite\Two\FacebookProvider', $config);
    }
}