Support the ongoing development of →
posted 5 years ago
Last updated 2 years ago.

With the first method, Laravel can automatically inject an appropriate type of request, which can have different properties. Mostly this is useful for route and method specific validation.

If you have

public function update(ProjectUpdateRequest $request, Project $project)
    $project->title = $request->input('title');
    return redirect('/projects');

You can than have a ProjectUpdateRequest class with rules just for a Project when it's being updated.

class ProjectUpdateRequest extends FormRequest
    public function rules()
        return [
            'name' => [

Sign in to participate in this thread!


Your banner here too?

Asim iteni iteniasim Joined 2 Nov 2018


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.