App Service Provider boot function in session save data not working. Refresh page session lost :(
public function boot(Request $request){
if (session('mydata') == ""){
session(['mydata' => $request->input("variable")]);
} else {
session('mydata');
}
}
Try this:
if ($request->session()->get('mydata') == "")
{
$request->session()->put($request->input('variable'));
}
I don't think you should need the else - since the only time that will hit is when the session is already != "".