Skip to content

[L5] Controller validate() method #584

@billmn

Description

@billmn

In Laravel 5.1 we can use $this->validate(...) method in a Controller, like this:

public function postLogin(Request $request)
{
    $this->validate($request, [
        'username' => 'required',
        'password' => 'required',
    ]);

    // ...
}

But if input is invalid the package breaks routing.
I have seen that the problem is solved for FormRequest (#462).

I think that can be solved overriding "validate" method of Illuminate\Foundation\Validation\ValidatesRequests ?

Is this the best approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions