Laravel背包select2_from_ajax传递多个或额外的搜索关键字进行搜索
Laravel Backpack select2_from_ajax pass multiple or extra search keyword for search
当前 select2_from_ajax 仅通过搜索 q
搜索字词。如何将多个搜索信息传递给该方法?
我需要传递当前记录ID /admin/product/4。
我需要 sql 按 product_id 4 和关键字过滤。我该怎么做?
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('Backpack\NewsCRUD\app\Models\Article')
->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('Backpack\NewsCRUD\app\Models\Article')
->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);
当前 select2_from_ajax 仅通过搜索 q
搜索字词。如何将多个搜索信息传递给该方法?
我需要传递当前记录ID /admin/product/4。
我需要 sql 按 product_id 4 和关键字过滤。我该怎么做?
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('Backpack\NewsCRUD\app\Models\Article')
->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('Backpack\NewsCRUD\app\Models\Article')
->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);