select、multipleSelect从api中获取选项列表
$form->select($column[, $label])->options([1 => 'foo', 2 => 'bar', '...val' => 'Option name']);
或者从api中获取选项列表:
$form->select($column[, $label])->options('/api/users');
其中api...接口的格式必须为下面格式:
[
{
"id": 9,
"text": "xxx"
},
{
"id": 21,..."text": "xxx"
},
...
]
如果选项过多,可通过ajax方式动态分页载入选项:
$form->select('user_id')->options(function...('q');
return User::where('name', 'like', "%$q%")->paginate(null, ['id', 'name as text']);
}
接口返回的数据结构为