skip to Main Content

In laravel,I’m using redirect function to redirect to another controller with values,like redirect(‘my-page,with[‘value1’]=>$values) and im getting the values using session->flash(),I got the values,but if I refresh the page,my values are gone,how to solve it

Tried many methods if the page was refreshed,I got null values

2

Answers


  1. Session::put('value1', $values);
    return redirect('my-page');
    

    in other controller:

    Session::get('value1');
    
    Login or Signup to reply.
  2. From Laravel documentation

    Sometimes you may wish to store items in the session for the next
    request. You may do so using the flash method.

    $request->session()->flash('status', 'Task was successful!');
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search