<?php
declare (strict_types = 1);

namespace app\admin\controller\v1;

use app\admin\model\v1\ProductCompatPartsModel;

class ProductCompatParts
{
    /**
     * 兼容配件列表
     */
    public function list()
    {
        $params = request()->param([
            'name',
        ]);

        $list = ProductCompatPartsModel::withoutField([
                'language_id',
                'sort',
                'disabled',
                'created_at',
                'updated_at',
                'deleted_at'
            ])
            ->language(request()->lang_id)
            ->disabled(false)
            ->withSearch('name', [
                'name' => $params['name']??null
            ])
            ->order(['id' => 'desc'])
            ->select();

        return success('获取成功', $list);
    }
}
