dimanche 1 décembre 2019

Getting error : `Undefined index: tmp_appointment_id` for Session in Laravel [duplicate]

I have set a value for a Session in one function. But while try to retrieve the value of that Session in another function I got the below error

local.ERROR: Undefined index: tmp_appointment_id {"exception":"[object] (ErrorException(code: 0): Undefined index: tmp_appointment_id at /home/laserme/public_html/new/app/Http/Controllers/homeController.php:94)

Here is my controller with two functions

public function tmp_appointment(Request $request)
{        
  $_SESSION['tmp_appointment_id'] = '123';

  return '200';
}
public function appointment_store(Request $request)
{
  return $_SESSION['tmp_appointment_id']; //got error for this line
}

I have also use use Session; at the top of my controller.

I understand that the error means that tmp_appointment_id index is not defined. But I defined it !

Can't get the solution yet.

Anybody help please ? Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire