<?php

namespace App\Models;

use App\Models\Users\AccountsModel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use App\Models\Users\BroadcastLog;

class WhatsappApi extends Model
{
    public $api_url;
    public $token;
    public $phone_number_id;
    function __construct()
    {
        // get the cred from accounts table(or selected from the dropdown account)
        $user = Auth::user();
        $account_id = session('account_id');
        $accountData = AccountsModel::find($account_id);
        $this->api_url = $accountData->api_url;
        $this->token = $accountData->user_access_token;
        $this->phone_number_id = $accountData->phone_number_id;
        $this->waba_id = $accountData->waba_id;
    }
    
}
