I’m trying to save cookies with and I’m not getting it, it even returns with the $ this->read() function, but it does not save the cookie in the browser. No error is shown, just does not work. I am sending the data by ajax to a controller and it is calling the current component.
namespace Cake\Controller\Component;
use Cake\Controller\Component;
use Cake\Controller\Component\CookieComponent;
class StepsComponent extends CookieComponent {
public function criarStep($dataCookie, $StepCurrent) {
$this->configKey($StepCurrent, [
'path' => '/',
'expires' => '+10 days',
'httpOnly' => false,
'encryption' => false
]);
$this->write($StepCurrent, [$dataCookie]);
return $this->read($StepCurrent);
}
}