public static function createTicket($userId) { /* Remove existing ticket */ Cookie::delete(static::COOKIE_NAME); $ticket = Guid::encrypt(static::getSalt(), join('|', [$userId, Carbon::now()->addMinutes(static::$ticketExpireMinutes)->toW3cString()])); Cookie::create(static::COOKIE_NAME, $ticket); }
public static function set($id, $value) { $data = [serialize($value), static::getSecret()]; $data = Guid::encrypt(static::getSecret(), join('|', $data)); $_SESSION[$id] = $data; }