Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/audigitalstore.fixmate.id/app/Helpers/
Upload File :
Current File : /home/aplikasiposinfo/public_html/audigitalstore.fixmate.id/app/Helpers/HelperWa.php

<?php

namespace App\Helpers;

use App\Helpers\ProviderWa\ProviderWoowa;
use App\Models\IntegrasiWhatsapp;



class HelperWa
{
    public static function SendMessage($no_hp,$message){
        $ptn = "/^0/";  // Regex
        $rpltxt = "+62";  // Replacement string
        $no_hp = preg_replace($ptn, $rpltxt, "$no_hp");
        
        // if still doesnt have +62
        if (strpos($no_hp, '+62') === false) {
            $no_hp = '+62' . $no_hp;
        }
        $integrasiWhatsapp = IntegrasiWhatsapp::where('used',1)->first();

        if($integrasiWhatsapp && $integrasiWhatsapp->api_key){
            $key = $integrasiWhatsapp->api_key;

            switch ($integrasiWhatsapp->provider) {
                case 'woowa-v4':
                    return ProviderWoowa::SendMessage($no_hp,$message,$key,4);
                    break;
                case 'woowa-v3':
                    return ProviderWoowa::SendMessage($no_hp,$message,$key);
                    break;
                
                default:
                    # code...
                    return 0;
                    break;
            }
        }
        return 0;
    }

    public static function SendMessageFile($no_hp,$file_path){
        $ptn = "/^0/";  // Regex
        $rpltxt = "+62";  // Replacement string
        $no_hp = preg_replace($ptn, $rpltxt, "$no_hp");
        
        // if still doesnt have +62
        if (strpos($no_hp, '+62') === false) {
            $no_hp = '+62' . $no_hp;
        }
        $integrasiWhatsapp = IntegrasiWhatsapp::where('used',1)->first();

        if($integrasiWhatsapp && $integrasiWhatsapp->api_key){
            $key = $integrasiWhatsapp->api_key;

            switch ($integrasiWhatsapp->provider) {
                case 'woowa-v4':
                    return ProviderWoowa::SendMessageFile($no_hp,$file_path,$key,4);
                    break;
                case 'woowa-v3':
                    return ProviderWoowa::SendMessageFile($no_hp,$file_path,$key);
                    break;
                
                default:
                    # code...
                    break;
            }
        }
        return 0;
    }

    public static function ScheduleMessage($no_hp,$message,$datetimes){
        $ptn = "/^0/";  // Regex
        $rpltxt = "+62";  // Replacement string
        $no_hp = preg_replace($ptn, $rpltxt, "$no_hp");
        
        // if still doesnt have +62
        if (strpos($no_hp, '+62') === false) {
            $no_hp = '+62' . $no_hp;
        }
        $integrasiWhatsapp = IntegrasiWhatsapp::where('used',1)->first();

        if($integrasiWhatsapp && $integrasiWhatsapp->api_key){
            $key = $integrasiWhatsapp->api_key;

            switch ($integrasiWhatsapp->provider) {
                case 'woowa-v4':
                    return ProviderWoowa::ScheduleMessage($no_hp,$message,$datetimes,$key,4);
                    break;
                case 'woowa-v3':
                    return ProviderWoowa::ScheduleMessage($no_hp,$message,$datetimes,$key);
                    break;
                
                default:
                    # code...
                    return 0;
                    break;
            }
        }
        return 0;
    }

    public static function ScheduleMessageFile($no_hp,$file_path,$datetimes){
        $ptn = "/^0/";  // Regex
        $rpltxt = "+62";  // Replacement string
        $no_hp = preg_replace($ptn, $rpltxt, "$no_hp");
        
        // if still doesnt have +62
        if (strpos($no_hp, '+62') === false) {
            $no_hp = '+62' . $no_hp;
        }
        $integrasiWhatsapp = IntegrasiWhatsapp::where('used',1)->first();

        if($integrasiWhatsapp && $integrasiWhatsapp->api_key){
            $key = $integrasiWhatsapp->api_key;

            switch ($integrasiWhatsapp->provider) {
                case 'woowa-v4':
                    return ProviderWoowa::ScheduleMessageFile($no_hp,$file_path,$datetimes,$key,4);
                    break;
                case 'woowa-v3':
                    return ProviderWoowa::ScheduleMessageFile($no_hp,$file_path,$datetimes,$key);
                    break;
                
                default:
                    return 0;
                    break;
            }
        }
        return 0;
    }

    public static function RemoveScheduleMessage($id_pesan){
        $integrasiWhatsapp = IntegrasiWhatsapp::where('used',1)->first();

        if($integrasiWhatsapp && $integrasiWhatsapp->api_key){
            $key = $integrasiWhatsapp->api_key;

            switch ($integrasiWhatsapp->provider) {
                case 'woowa-v4':
                    return ProviderWoowa::RemoveScheduleMessage($id_pesan,$key,4);
                    break;
                case 'woowa-v3':
                    return ProviderWoowa::RemoveScheduleMessage($id_pesan,$key);
                    break;
                
                default:
                    return 0;
                    break;
            }
        }
        return 0;
    }

    
}

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]