Getting subsets of validated data in Laravel 8.x

1 · Amit Merchant · Aug. 20, 2021, 6:41 p.m.
Laravel offers mainly two ways to validate the request data inside of the controller methods. Either you can directly call the validate method on the Illuminate\Http\Request object and set the validation rules or you can create a form request and type-hint the controller method with this form request class. Here’s how you can validate request data using the first method. public function store(Request $request) { $validated = $request->validate([ 'title' => 'required|unique:posts', ...