<?php

namespace App\Api\Http\Controllers\Api\V2\SwitchCompany;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class SwitchCompanyController extends Controller
{
    public function switchCompany(Request $request)
    {
        $request->company == 1;
        if($request->company == 1){
            $url = 'https://crm.hiliteproperties.com/index.php/api/v1/login-without-password';
        
            $formData = [
                'username' => $request->username,
                'status' => '1',
            ];
 
            $response = Http::withoutVerifying()->post($url, $formData);
            $responseData =  $response->json();
          
            return $responseData;
      
           
          
        }elseif($request->company == 2){
            $url = 'https://crm.hilite.work/index.php/api/v1/login-without-password';
        
            $formData = [
                'username' => $request->username,
                'status' => '1',
            ];
 
            $response = Http::withoutVerifying()->post($url, $formData);
            $responseData = $response->json();
           
            return $responseData;

        }elseif($request->company == 3){
            $url = 'https://crm.hilitebuilders.com/index.php/api/v1/login-without-password';
        
            $formData = [
                'username' => $request->username,
                'status' => '1',
            ];
 
            $response = Http::withoutVerifying()->post($url, $formData);
            $responseData = $response->json();
           
            return $responseData;
        }
    }
}
