It doesn’t necessarily validate anything but simply removes the associated field from your validated data. Very useful for fields that you don’t eventually need for fulfilling the request.
public function store (Request $request): Response
{
$validated = $request→validate([
'name' => 'required',
'terms_and_conditions' => 'accepted | exclude',
]);
// You don't need this...
User::create($request->except('terms_and_conditions'));
// The "exclude" rule ensures that the given key
// is not part of the return validated() key;
User::create($validated));
}
PHP