Add the user information to the session payload.

@param  array  $payload
@return $this
540909
protected function addUserInformation(&$payload)
    {
        if ($this->container->bound(Guard::class)) {
            $payload['user_id'] = $this->userId();
        }

        return $this;
    }
97576
public function write(array $parameters, $payload)
    {
        // retrieve the driver
        $driver = $this->getDriver();

        // add authentication to the driver if needed
        if (!empty($this->username) && !empty($this->password)) {
            $parameters += ['auth' => [$this->username, $this->password]];
        }

        // set the given parameters
        $driver->setParameters($parameters);

        // send the points to influxDB
        if (is_array($payload)) {
            $payload = implode("\n", $payload);
        }

        return $driver->write($payload);
    }
566555
public function payload(array $data)
    {
        foreach ($data as $key => $value) {
            $this->data->{$key} = $value;
        }

        return $this;
    }
438009
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $delivery = Delivery::create($payload['delivery']);

        return new static($senderId, $recipientId, $delivery);
    }
1190684
public function updateUserAsyncWithHttpInfo($user_id, $payload_account)
    {
        $returnType = '';
        $request = $this->updateUserRequest($user_id, $payload_account);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
1185810
public function addContextPayload($payload = [], $operationId = null, $responseActual = [])
    {
        if (!$payload) {
            return $this;
        }
        $payload = json_decode(json_encode($payload), true);
        if ($payload === $this->previousPayload && !$responseActual) {
            // The payload is the same.
            // No additional response data has not been provided to append.
            // No need to recalculate this context.
            $this->context['payload'] = $this->previousContextPayload;

            return $this;
        }

        // Set the context of the payload and reset the pivot data need flags.
        $this->context['payload'] = $payload;
        $this->previousPayload    = $payload;
        $this->needsDeviceData    = false;
        $this->needsUtmData       = false;
        $this->needsDncData       = false;

        // File payload pivot data check.
        if (!empty($payload['body']) && !empty($payload['settings'])) {
            if (!empty($payload['body']) && is_array($payload['body'])) {
                foreach ($payload['body'] as $column) {
                    foreach (['value', 'default_value', 'test_value'] as $key) {
                        if (!empty($column[$key])) {
                            $this->findPivotDataTokens($column[$key]);
                        }
                    }
                }
            }
        }

        // API Payload pivot data check, and addition of actual response data from previous request operations.
        if (!empty($payload['operations'])) {
            foreach ($payload['operations'] as $id => $operation) {
                foreach (['request', 'response'] as $opType) {
                    if (!empty($operation[$opType])) {
                        foreach (['headers', 'body'] as $fieldType) {
                            if (!empty($operation[$opType][$fieldType])) {
                                $fieldSet = [];
                                if (
                                    'response' === $opType
                                    && $id === $operationId
                                    && null !== $responseActual[$fieldType]
                                ) {
                                    // While running in realtime.
                                    $fieldSet = $responseActual[$fieldType];
                                } else {
                                    foreach ($operation[$opType][$fieldType] as $field) {
                                        if (null !== $field['key']) {
                                            $fieldSet[$field['key']] = isset($field['value']) ? $field['value'] : null;
                                            if ('request' === $opType) {
                                                $this->findPivotDataTokens($field['value']);
                                            }
                                        }
                                    }
                                }
                                $this->context['payload']['operations'][$id][$opType][$fieldType] = $fieldSet;
                                if (
                                    'request' === $opType
                                    && !empty($operation[$opType]['manual'])
                                    && $operation[$opType]['manual']
                                    && !empty($operation[$opType]['template'])
                                ) {
                                    $this->findPivotDataTokens($operation[$opType]['template']);
                                }
                            }
                        }
                    }
                }
            }
        }

        $this->previousContextPayload = $this->context['payload'];

        return $this;
    }
1258193
public function enqueue($payload, $priority = 0)
    {
        $this->collection
            ->createDocument(array(
                'payload'   => $payload,
                'priority'  => (int) $priority,
                'datetime'  => new \MongoDate,
            ))
            ->save();
        
        return $this;
    }
462422
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $passThreadControl = PassThreadControl::create($payload['pass_thread_control']);

        return new static($senderId, $recipientId, $timestamp, $passThreadControl);
    }
8547
public static function verifyUser($payload)
    {
        $userId = $payload->get('user_id');
        $userKey = $payload->get('sub');
        $userInfo = ($userId) ? User::getCachedInfo($userId) : null;

        if (!empty($userInfo) && $userKey === md5($userInfo['email'])) {
            return true;
        } else {
            throw new TokenInvalidException('User verification failed.');
        }
    }
265511
public static function create(array $payload)
    {
        $referral = isset($payload['referral']) ? Referral::create($payload['referral']) : null;

        return new static($payload['payload'], $referral);
    }
415111
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $takeThreadControl = TakeThreadControl::create($payload['take_thread_control']);

        return new static($senderId, $recipientId, $timestamp, $takeThreadControl);
    }
285111
public static function create(array $payload)
    {
        $text = isset($payload['text']) ? $payload['text'] : null;
        $attachments = isset($payload['attachments']) ? $payload['attachments'] : [];
        $quickReply = isset($payload['quick_reply']) ? $payload['quick_reply']['payload'] : null;

        return new static($payload['mid'], $payload['seq'], $text, $attachments, $quickReply);
    }
205776
protected function handleCustomerSubscriptionDeleted(array $payload)
    {
        $user = $this->getUserByStripeId($payload['data']['object']['customer']);

        if ($user) {
            $user->subscriptions->filter(function ($subscription) use ($payload) {
                return $subscription->stripe_id === $payload['data']['object']['id'];
            })->each(function ($subscription) {
                $subscription->markAsCancelled();
            });
        }

        return new Response('Webhook Handled', 200);
    }
311609
public function encode(array $payload)
    {
        try {
            $this->jws->setPayload($payload)->sign($this->secret);

            return $this->jws->getTokenString();
        } catch (Exception $e) {
            throw new JWTException('Could not create token: '.$e->getMessage());
        }
    }
1066647
public function setPayload(string $payload): self
    {
        $this->checkContentType();
        $this->isValidString($payload, 1000);

        $this->payload = $payload;

        return $this;
    }
124754
public function process($payload)
    {
        foreach ($this->stages as $stage) {
            $payload = call_user_func($stage, $payload);
        }
        return $payload;
    }
1085751
private function setPayload($payload)
	{
		if ( (is_string($payload) && empty($payload)) || (is_array($payload) && count($payload) == 0) )
		{
			// Empty strings or arrays are not allowed
			throw new \InvalidArgumentException('Invalid payload for message. Payload was empty, but not null)');
		}
		else if (is_array($payload) || null === $payload)
		{
			if ( isset($payload['aps']) )
			{
				// Reserved key is used
				throw new \InvalidArgumentException('Invalid payload for message. Custom payload may not contain the reserved "aps" key.');
			}
			else
			{
				// This is okay, set as payload
				$this->payload = $payload;
			}
		}
		else
		{
			// Try to decode JSON string payload
			$payload = json_decode($payload, true);

			// Check if decoding the payload worked
			if (null === $payload) {
				throw new \InvalidArgumentException('Invalid payload for message. Payload was invalid JSON.');
			}

			// Set as payload
			$this->payload = $payload;
		}
	}