Validated Input

Retrieve the request data that underwent validation

$validated = $request->validated();

Or with safe(), which returns an instance of Illuminate\Support\ValidatedInput

$validated = $request->safe()->only(['name', 'email']);
$validated = $request->safe()->except(['name', 'email']);
$validated = $request->safe()->all();

#Iterate

foreach ($request->safe() as $key => $value) {
    //
}

#Access as an array

$validated = $request->safe();
$email = $validated['email'];
Comments