I need to receive value from a redirect with with no controller

0

In my class loginController I make the following path:

return Redirect::to('home')->cookie($nome)->cookie($sessionid)->with('cnpj',$cnpj);

I need to have this data $cnpj to pass from home.blade.php to cliente.blade.php

How do I do this? At home there is no form. I just do not want to go with a cookie. I actually do not want to spend any as a cookie.

    
asked by anonymous 03.06.2018 / 08:17

1 answer

0

In fact when you use Redirect::to('home')->with(variavel) this variable can already be accessed in your other method (home). For unavoidable access you have to use a session. You can get the value of the CNPJ from this method: Session::get('data');

You have to remember that PHP redirection reloads the page, executing a request, generating a new PHP run. So the memory of the before variables are no longer accessible.

By your posted code, I imagine you are using an older version of Laravel, I recommend reading the framework documentation:

link

    
03.06.2018 / 09:23