Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Parameter Validation #170

Open
arian-sakhaei opened this issue May 20, 2023 · 1 comment
Open

Query Parameter Validation #170

arian-sakhaei opened this issue May 20, 2023 · 1 comment

Comments

@arian-sakhaei
Copy link

Hi,
Can you help me on how to use FormRequest to validate query parameters?

here's a my code:

Route:

Route::controller(UserController::class)->group(function () {
    Route::get('get-user/{id}', 'getUser');
});

Controller:

public function getUser(UserController $request) // or => (UserController $id)
{
// can't get the parameter I expect
}

and then there is a EditUserRequest class extending FormRequest which I wish to use!
tnx for the help in advance.

@alexoleynik0
Copy link

Hi, is this still relevant?
The best way I figured out on how to do validation on route's values is to merge them into request body in your UserEditRequest's prepare method override (or something like that, can't check and share the code right now - see the class you're extending).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants