Validate in Laravel, That at Least One Checkbox is Checked

If you have a form with multiple checkboxes (categories, tags, …) and you want to be sure, that at lease on checkbox is checked, you can add this validation:

public function store(Request $request)
{
	$validatedData = $request->validate([
		'category' => 'required',
	]);

	// more code

}

The ‘required’ validation checks, that there is at least one checked checkbox – all you need.