📅  最后修改于: 2022-03-11 14:54:03.640000             🧑  作者: Mango
$cars = Car::when($request->get('make'), function ($query, $make) {
$query->where('make', $make);
})
->when($request->get('model'), function ($query, $model) {
$query->where('model', $model);
})