skip to Main Content

I have a url and I want make a redirection and I want to keep the url parameters.
I’m using the ->with method but it doesn’t work.

Example:
http://mywebsite.local/product-name-random?select_article=710

I want redirect this url to:
http://mywebsite.local/father-category-of-this-product?select_article=710

I’m using this code but it doesn’t work:

return redirect()->route('web.custom_url', $father_cathegory->seo->slug)->with('select_article', Input::get('select_article')); 

->with() is not working. Nothing happens.

Im using Laravel 5.5.

3

Answers


  1. You should try this way:

    return Redirect::to('/admin/slider?rdStatus='. $rdStatus);
    
    Login or Signup to reply.
  2. you can also use

    redirect()->route('web.custom_url',[ $father_cathegory->seo->slug])->withInput();
    

    it will redirect to route with input

    Login or Signup to reply.
  3. Using ->with() you’re flashing the session.
    You could do something like this:

    $to = route('web.custom_url', $father_cathegory->seo->slug) . 
        '?select_article=' . Input::get('select_article');
    return redirect()->to($to);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search