2

I have some filters on my view and I want to get the parameters of my current URL and do something like edit any of my items in the page and go back with all the filters again after edit.

My example URL:

localhost:8000/equipamentos/filtro?filter_descricao=APARELHO+ULTRASSOM&filter_patrimonio=0

Then I choose any item to edit and go to:

localhost:8000/equipamentos/332/edit

After I change something I want to be redirected to the same URL with the filters in the beginning, like redirect and append filtro?filter_descricao=APARELHO+ULTRASSOM&filter_patrimonio=0

Thanks!

2
  • Do you mean $_GET['your_parameter_name']? Commented Nov 18, 2014 at 11:28
  • That would really help if you posted your code. Commented Nov 18, 2014 at 12:48

2 Answers 2

3

Use the Input facade:

// All
$data = Input::all();

// $_REQUEST['foo']
$data = Input::get('foo');          // null if foo doesn't exist
$data = Input::get('foo', 'bar');   // if foo doesn't exist, the value is bar

Then you can handle the redirection in the controller on in a filter.

Sign up to request clarification or add additional context in comments.

3 Comments

dont work because I'm not posting to edit, Is a get route just a link which I pass the id to edit view: <a href="{{ route('equipamentos.edit', array($equipamento->cod)) }}" data-toggle="tooltip" title="Editar" data-placement="top" class="legenda"> <i class="btn btn-info glyphicon glyphicon-pencil" style="width: 41px; height:34px;"></i></a>
Yeah I set up the filter then edit, and used input get and receive a null value
0

I just drafted out the code and it is working.

Route::get('/query', function() {

    return Redirect::route('result', Input::query());
});

Route::get('/result', [ 'as' => 'result', 'uses' => function() {

    return Response::make(Input::all());
}]);

Either Input::all() or Input::query() should work to retrieve GET parameters.

I'm using Laravel 4.2.11

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.