laravel when的用法
```
public function taskItemList(Request $request)
{
$templateId = $request->input('template_id', null);
$taskId = $request->input('task_id', null);
$taskItem = PushTaskItem::query()
->when($templateId !== null, function ($query) use ($templateId) {
$query->where('template_id', $templateId);
})
->when($taskId !== null, function ($query) use ($taskId) {
$query->where('task_id', $taskId);
});
$count = $taskItem->count();
}
```