<?php

namespace App\Admin\Repositories;

use App\Models\BaseProductCategory as Model;
use App\Models\BaseProductParameter;
use Dcat\Admin\Repositories\EloquentRepository;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\ModelTree;

class BaseProductCategory extends EloquentRepository
{

    /**
     * Model.
     *
     * @var string
     */
    protected $eloquentClass = Model::class;




    // 调用模型方法
    public static function selectOptions(\Closure $closure = null)
    {
       $selectOptions =  Model::class::selectOptions($closure);
        return $selectOptions;
    }


    public static function getParameter($categoryId)
    {
        $categoryRow =  Model::Class::find($categoryId);
        if ($categoryRow->baseProductParameter) {
            return $categoryRow->baseProductParameter->content;
        } else {
            return "[]";
        }
    }
}
