SHasdsd
SHasdsd

Reputation: 21

Laravel filter by URL with form

I am little bit new in Laravel, I use Laravel 6. I need to implement filter, I have POST form of 7 parameters. After submit I would like to filter data based on filter and generate corresponding URL, e.g.../public/en/orders/param1/param2/param3.../param7

I'd like to do it by URL because you can send link and 2nd side will see the same. My biggest issue is that I can't find way how to transform data from form to URL.

I don't even know if POST is neccessary, I think GET is enough.

Thanks guys.

Upvotes: 0

Views: 240

Answers (1)

elyas.m
elyas.m

Reputation: 1540

If you use query string, in your routes file you can create a new route like this

Route::get('/orders/', 'yourController@action');

and in your controller get all query string with $request variable :

public function action (Request $request){
     $param1 = $request->get('param1');
     .....
}

You can see and test all params by dd function in your controller:

dd($request->all());

Upvotes: 1

Related Questions