laravel-admin 中列表筛选

1、简单筛选

$filter->is('aid', '报警模块')->select(Alarm::all()->pluck('title', 'id'));

2、筛选联动

$filter->is('pid', '物业公司')->select(Property::all()->pluck('name', 'id'))->load('gid', '/admin/getDepartment');
$filter->is('gid', '部门')->select(PropertyDepartment::all()->pluck('name', 'id'));

/*
 * 根据物业公司的id,获取公司的部门信息
 */
public function getDepartment(Request $request){

    $pid = $request->get('q');

    return PropertyDepartment::where('pid','=', $pid)->get(['id', DB::raw('name as text')]);
}

你可能感兴趣的:(laravel,laravel-admin)