Question and answer is powered by AnsPress.io
I need help, when I am checking login data, if match data then redirect onather page and put data in a session variable, I don’t know how to use it, please help with code
If you want to store value in the Session use session()->put(). you need to follow this example code for understand.
You need to put method stores of data in the session:
<?php
public function showProfile(Request $request)
{
$request->session()->put(‘key’, ‘value’);
}
?>
at first store data in a variable which you want to set in session variable then put value in a session variable. use this code
Session::put(‘user_id’, $user_id);