<?php


namespace ModulesGarden\ProxmoxAddon\Core\Helper;


use ModulesGarden\ProxmoxAddon\App\Models\Whmcs\CustomField;

class AdvancedUserHelper
{

    protected $userid;

    /**
     * AdvancedUserHelper constructor.
     * @param $userid
     */
    public function __construct($userid)
    {
        $this->userid = $userid;
    }


    public  function isAdvanced(){
        if(!CustomField::ofClient()->ofName(\ModulesGarden\Servers\ProxmoxCloudVps\App\Enum\CustomField::ADVANCED_USER)->count()){
            return false;
        }
        return CustomField::ofClient()
                     ->ofName(\ModulesGarden\Servers\ProxmoxCloudVps\App\Enum\CustomField::ADVANCED_USER)
                    ->first()
                    ->customFieldValue
                    ->where('relid',$this->userid)
                    ->first()
                    ->value == "on";
    }

}