xxxxxxxxxx
// Retrieve session data
$value = session('key'); // Replace 'key' with the actual key of the session data
// Check if session data exists
if (session()->has('key')) {
// Session data exists, you can proceed with further actions
$value = session('key');
} else {
// Session data doesn't exist
$value = null; // Or any default value you want
}