<?php

namespace App\Modules\Sys\Services;

use App\Modules\Sys\Models\PromotionGroupConfig;

/**
 * 
 * @method static string OUT_CHANNEL_ID_LIST() 外部渠道号;
 * @method static string INNER_CHANNEL_ID_LIST() 内部渠道号;
 * @method static string CHANNEL_ID_LIST() 渠道号;
 */
class PromotionGroupConfigService
{
    private $model;

    private static $_instance;

    public function __construct()
    {
        $this->model = (new PromotionGroupConfig)->filter();
    }

    public function getItem(string $option)
    {
        return $this->model->where('option', $option)->pluck('value')->first();
    }

    public static function __callStatic($name, $arguments)
    {
        if (self::$_instance == null) {
            self::$_instance = new PromotionGroupConfigService;
        }
        return self::$_instance->getItem($name);
    }

    public function __get($name)
    {
        return $this->getItem($name);
    }
}
