Laravel Backpack select2_from_jax传递多个或额外的搜索关键字进行搜索



当前select2_from_jax只传递搜索项的搜索q。如何将多个搜索信息传递给该方法?

我需要传递当前记录ID/admin/product/4。

我需要通过product_id 4和关键字进行sql过滤。我该怎么做?

CRUD::field('select2_from_ajax')
->type('select2_from_ajax')
->label("Article <small class='font-light'>(select2_from_ajax for a 1-n relationship)</small>")
->entity('article')
->attribute('title')
->model('BackpackNewsCRUDappModelsArticle')
->data_source(url('api/article'))
->placeholder('Select an article')
->minimum_input_length(2)
->wrapper(['class' => 'form-group col-md-6'])
->tab('Selects');

为了传递所有表单值,只需添加->include_all_form_fields(true)

完整字段定义如下:

CRUD::field('select2_from_ajax')
->type('select2_from_ajax')
->label("Article <small class='font-light'>(select2_from_ajax for a 1-n relationship)</small>")
->entity('article')
->attribute('title')
->model('BackpackNewsCRUDappModelsArticle')
->data_source(url('api/article'))
->placeholder('Select an article')
->minimum_input_length(2)
->wrapper(['class' => 'form-group col-md-6'])
->tab('Selects')
->include_all_form_fields(true);

最新更新