Fire the SendPostToLaSalleCRMemailList event.

This method is called from the confirmation view in the LaSalle List Management package.

@param   Request $request
@return  mixed
190876
public function publishPostEvent(Request $request) {

        // Laravel's Mail::send second "data" param must be an array, not an object.
        $post                     = $this->model->FindOrFail($request->input('postID'))->toArray();
        $post['listID']           = $request->input('listID');
        $post['eventDescription'] = $request->input('eventDescription');

        event(new PublishThePost($post));

        $message =  "You successfully ".$post['eventDescription']."!";
        Session::flash('message', $message);
        Session::flash('status_code', 200 );

        return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
    }
130517
public function handleWebhook(Request $request = null)
    {
        if (!$request) {
            $request = Request::createFromGlobals();
            $data = json_decode($request->getContent(), true);
            $request->request->replace($data);
        }

        if (!$this->isTrelloWebhook($request) || !$action = $request->get('action')) {
            return;
        }

        if (!isset($action['type'])) {
            throw new InvalidArgumentException('Unable to determine event from request.');
        }

        if (!isset($action['data'])) {
            throw new InvalidArgumentException('Unable to retrieve data from request.');
        }

        $eventName = $action['type'];
        $data      = $action['data'];

        switch ($eventName) {
            case Events::BOARD_CREATE:
            case Events::BOARD_UPDATE:
            case Events::BOARD_COPY:
                $event = new Event\BoardEvent();
                $event->setBoard($this->getBoard($data['board']['id']));
                break;
            case Events::BOARD_MOVE_CARD_FROM:
            case Events::BOARD_MOVE_CARD_TO:
                $event = new Event\CardMoveEvent();
                $event->setCard($this->getCard($data['card']['id']));
                break;
            case Events::BOARD_MOVE_LIST_FROM:
            case Events::BOARD_MOVE_LIST_TO:
                $event = new Event\ListMoveEvent();
                $event->setList($this->getList($data['list']['id']));
                break;
            case Events::BOARD_ADD_MEMBER:
            case Events::BOARD_MAKE_ADMIN:
            case Events::BOARD_MAKE_NORMAL_MEMBER:
            case Events::BOARD_MAKE_OBSERVER:
            case Events::BOARD_REMOVE_ADMIN:
            case Events::BOARD_DELETE_INVITATION:
            case Events::BOARD_UNCONFIRMED_INVITATION:
                $event = new Event\BoardMemberEvent();
                $event->setBoard($this->getBoard($data['board']['id']));
                $event->setMember($this->getMember($data['member']['id']));
                break;
            case Events::BOARD_ADD_TO_ORGANIZATION:
            case Events::BOARD_REMOVE_FROM_ORGANIZATION:
                $event = new Event\BoardOrganizationEvent();
                $event->setBoard($this->getBoard($data['board']['id']));
                $event->setOrganization($this->getOrganization($data['organization']['id']));
                break;
            case Events::LIST_CREATE:
            case Events::LIST_UPDATE:
            case Events::LIST_UPDATE_CLOSED:
            case Events::LIST_UPDATE_NAME:
                $event = new Event\ListEvent();
                $event->setList($this->getList($data['list']['id']));
                break;
            case Events::CARD_CREATE:
            case Events::CARD_UPDATE:
            case Events::CARD_UPDATE_LIST:
            case Events::CARD_UPDATE_NAME:
            case Events::CARD_UPDATE_DESC:
            case Events::CARD_UPDATE_CLOSED:
            case Events::CARD_DELETE:
            case Events::CARD_EMAIL:
            case Events::CARD_ADD_LABEL:
            case Events::CARD_REMOVE_LABEL:
                $event = new Event\CardEvent();
                $event->setCard($this->getCard($data['card']['id']));
                break;
            case Events::CARD_COPY:
                $event = new Event\CardCopyEvent();
                $event->setCard($this->getCard($data['card']['id']));
                break;
            case Events::CARD_ADD_MEMBER:
            case Events::CARD_REMOVE_MEMBER:
                $event = new Event\CardMemberEvent();
                $event->setCard($this->getCard($data['card']['id']));
                $event->setMember($this->getMember($data['member']['id']));
                break;
            case Events::CARD_COMMENT:
            case Events::CARD_COPY_COMMENT:
                $event = new Event\CardCommentEvent();
                $event->setCard($this->getCard($data['card']['id']));
                $event->setComment($data['text']);
                break;
            case Events::CARD_FROM_CHECKITEM:
                $event = new Event\CardFromCheckItemEvent();
                $event->setCard($this->getCard($data['card']['id']));
                break;
            case Events::CARD_ADD_ATTACHMENT:
            case Events::CARD_DELETE_ATTACHMENT:
                $event = new Event\CardAttachmentEvent();
                $event->setCard($this->getCard($data['card']['id']));
                $event->setAttachment($data['attachment']);
                break;
            case Events::CARD_ADD_CHECKLIST:
            case Events::CARD_CREATE_CHECKLIST_ITEM:
            case Events::CARD_UPDATE_CHECKLIST_ITEM_STATE:
                $event = new Event\CardChecklistEvent();
                $event->setCard($this->getCard($data['card']['id']));
                $event->setChecklist($this->getChecklist($data['checklist']['id']));
                break;
            case Events::CARD_CREATE_CHECKLIST:
            case Events::CARD_UPDATE_CHECKLIST:
            case Events::CARD_REMOVE_CHECKLIST:
                $event = new Event\CardChecklistEvent();
                $event->setCard($this->getCard($data['cardTarget']['_id']));
                $event->setChecklist($this->getChecklist($data['checklist']['id']));
                break;
            case Events::ORGANIZATION_CREATE:
            case Events::ORGANIZATION_UPDATE:
                $event = new Event\OrganizationEvent();
                $event->setOrganization($this->getOrganization($data['organization']['id']));
                break;
            case Events::ORGANIZATION_ADD_MEMBER:
            case Events::ORGANIZATION_MAKE_NORMAL_MEMBER:
            case Events::ORGANIZATION_REMOVE_ADMIN:
            case Events::ORGANIZATION_DELETE_INVITATION:
            case Events::ORGANIZATION_UNCONFIRMED_INVITATION:
                $event = new Event\OrganizationMemberEvent();
                $event->setOrganization($this->getOrganization($data['organization']['id']));
                $event->setMember($this->getMember($data['member']['id']));
                break;
            case Events::MEMBER_JOINED:
            case Events::MEMBER_UPDATE:
                $event = new Event\MemberEvent();
                $event->setMember($this->getMember($data['member']['id']));
                break;
            case Events::POWERUP_ENABLE:
            case Events::POWERUP_DISABLE:
                $event = new Event\PowerUpEvent();
                $event->setPowerUp($data['powerUp']);
                break;
            default:
                throw new InvalidArgumentException(sprintf(
                    'Unknown event "%s" occured with following data: "%s".',
                    $eventName,
                    serialize($data)
                ));
        }

        $event->setRequestData($data);

        $this->dispatcher->dispatch($eventName, $event);
    }
349853
public function send(Request $request)
    {
        $response   = new GetIndexResponse();
        $rpbGetReq  = $this->createRpbMessage($request);
        $rpbGetResp = $this->client->send($rpbGetReq, RiakMessageCodes::YOKOZUNA_INDEX_GET_REQ, RiakMessageCodes::YOKOZUNA_INDEX_GET_RESP);

        if ( ! $rpbGetResp instanceof RpbYokozunaIndexGetResp) {
            return $response;
        }

        if ( ! $rpbGetResp->hasIndex()) {
            return $response;
        }

        $rpbIndex = is_array($rpbGetResp->index)
            ? reset($rpbGetResp->index)
            : $rpbGetResp->index;

        $response->nVal   = $rpbIndex->n_val;
        $response->name   = $rpbIndex->name;
        $response->schema = $rpbIndex->schema;

        return $response;
    }
683130
public function postSubscribe(Request $request) {

        // Does the email ID exist in the "list_emails" table for this list ID already?
        // We need the email ID, but only have an email address. See if this email address exists in the "emails" db table
        if ($this->subscribeToList->getEmailIDByTitle($request->input('email'))) {

            // yes, the email address exists in the "emails" db table
            if ($this->subscribeToList->getList_emailByEmailIdAndListId(
                   $this->subscribeToList->getEmailIDByTitle($request->input('email')),
                   $request->input('listID')
                )
            ) {
                return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_email_already_in_list', [
                    'title'             => $this->subscribeToList->getListnameByListId($request->input('listID')),
                    'email'             => $request->input('email')
                ]);
            }

        }


        // Add email to the email list
        $emailID = $this->subscribeToList->getEmailIDByTitle($request->input('email'));

        if (!$emailID) {

            // The email address does NOT exist in the "emails" db table.
            // So, create the email address in the "emails" db table
            // (i) prep the data
            $data = $this->subscribeToList->prepareEmailDataForInsert($request);

            // (ii) create the new record
            $emailID = $this->subscribeToList->createNewEmailRecord($data);
        }

        // if the INSERT to the "emails" db table failed, then try the subscribe all over again
        if (!$emailID) {
            $message = "Something did not quite go right in the processing. Please try again.";
            Session::flash('message', $message);
            return redirect('list/subscribe/'.$request->input('listID'))
                ->withInput()
            ;
        }


        // INSERT INTO list_email
        // consolidate POST vars and processed data into one array
        $input = array_merge($request->all(),['emailID' => $emailID]);

        // prep the data for the INSERT
        $data = $this->subscribeToList->prepareList_emailDataForInsert($input);

        // INSERT record
        $list_emailID = $this->subscribeToList->createNewList_emailRecord($data);

        // if the INSERT into the "list_email" db table failed, then try the subscribe all over again
        if (!$list_emailID) {
            $message = "Something did not go quite right in the processing. Please try again.";
            Session::flash('message', $message);
            return redirect('list/subscribe/'.$request->input('listID'))
                ->withInput()
                ;
        }


        if ($request->has('surname')) {


            $peopleID = $this->subscribeToList->isFirstnameSurname($request->input('first_name'), $request->input('surname'));

            if (!$peopleID) {
                // prep the data for the INSERT
                $data = $this->subscribeToList->preparePeoplesDataForInsert($input);

                // INSERT record
                $peopleID = $this->subscribeToList->createNewPeoplesRecord($data);
            }


            if ($peopleID) {
                // INSERT INTO people_email
                $people_emailID = $this->subscribeToList->createNewPeople_emailRecord(['people_id' => $peopleID, 'email_id' => $emailID]);
            }


            if (!$people_emailID) {
                // whaddaya mean the INSERT INTO "people_email" failed?! try again...
                $people_emailID = $this->subscribeToList->createNewPeople_emailRecord(['people_id' => $peopleID, 'email_id' => $emailID]);
            }
        }

        return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.subscribe_success', [
            'title'             => $this->subscribeToList->getListnameByListId($request->input('listID')),
            'email'             => $request->input('email')
        ]);
    }
1094619
public function sendResetLinkEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);

        //We will send the password reset link to this user. Once we have attempted
        //to send the link, we will examine the response then see the message we
        //need to show to the user. Finally, we'll send out a proper response.
        $response = Password::broker()->sendResetLink($request->only('email'));

        if ($response == 'passwords.sent') {
            notify()->success('Success!', 'Password email sent to client.');
        }
        else {
            notify()->error('Oops', 'Something went wrong', 'warning shake animated');
        }

        return redirect()->back();
    }
1193222
public function listAction(Request $request)
    {
        return new JsonResponse(
            $this->finder->search(
                'UJM\ExoBundle\Entity\Item\Item',
                $request->query->all(),
                [Transfer::INCLUDE_SOLUTIONS, Transfer::INCLUDE_ADMIN_META]
            )
        );
    }
933915
public function postAction(Request $request)
    {
        $document = $this->documentManager->create(Structure::TYPE_SNIPPET);
        $form = $this->processForm($request, $document);

        return $this->handleView($form->getData());
    }
320816
protected function processPost(Request $request)
    {
        $resource = $this->getResourceManager()->createNewInstance();
        return $this->processAction($request, 'POST', $resource);
    }
778712
public function listAction(Request $request)
    {
        $type = $request->get('type', Elementtype::TYPE_FULL);

        $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');

        $elementtypes = [];
        foreach ($elementtypeService->findAllElementtypes() as $elementtype) {
            if ($type !== $elementtype->getType()) {
                continue;
            }

            if ($elementtype->getDeleted()) {
                continue;
            }

            $elementtypes[$elementtype->getTitle().$elementtype->getId()] = [
                'id' => $elementtype->getId(),
                'title' => $elementtype->getTitle(),
                'icon' => $elementtype->getIcon(),
                'version' => $elementtype->getRevision(),
                'type' => $elementtype->getType(),
            ];
        }

        ksort($elementtypes);
        $elementtypes = array_values($elementtypes);

        $checker = $this->get('phlexible_element.checker');
        $changes = $checker->check();
        $hasChanges = false;
        foreach ($changes as $change) {
            if ($change->getNeedImport()) {
                $hasChanges = true;
                break;
            }
        }

        return new JsonResponse([
            'elementtypes' => $elementtypes,
            'total' => count($elementtypes),
            'changes' => $hasChanges,
        ]);
    }
161334
public function messagesSendAction(Request $request)
    {
        $query = $request->request->all();
        $messages = $this->om->findList('Claroline\PlannedNotificationBundle\Entity\Message', 'uuid', $query['messages']);
        $users = $this->om->findList('Claroline\CoreBundle\Entity\User', 'uuid', $query['users']);
        $this->manager->sendMessages($messages, $users);

        return new JsonResponse('success', 200);
    }
744540
protected function sendRequest(Request $request)
    {
        $curl = curl_init($this->getUrl($request));

        curl_setopt_array($curl, $this->curlOptions);
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request->getRequestFields()));

        $response = curl_exec($curl);

        if(curl_errno($curl))
        {
            $error_message  = 'Error occurred: ' . curl_error($curl);
            $error_code     = curl_errno($curl);
        }
        elseif(curl_getinfo($curl, CURLINFO_HTTP_CODE) != 200)
        {
            $error_code     = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            $error_message  = "Error occurred. HTTP code: '{$error_code}'";
        }

        curl_close($curl);

        if (!empty($error_message))
        {
            throw new RequestException($error_message, $error_code);
        }
        else
        {
            return $response;
        }
    }
724171
public function postResend(Request $request)
    {
        // Validate the form data
        $result = $this->validate($request, [
            'email' => 'required|email|max:255'
        ]);

        // Fetch the user in question
        $user = Sentinel::findUserByCredentials(['email' => $request->get('email')]);

        // Only send them an email if they have a valid, inactive account
        if (!Activation::completed($user)) {
            // Generate a new code
            $activation = Activation::create($user);

            // Send the email
            $code = $activation->getCode();
            $email = $user->email;
            Mail::to($email)->queue(new CentaurWelcomeEmail($email, $code, 'Account Activation Instructions'));
        }

        $message = 'New instructions will be sent to that email address if it is associated with a inactive account.';

        if ($request->expectsJson()) {
            return response()->json(['message' => $message], 200);
        }

        Session::flash('success', $message);
        return redirect('/dashboard');
    }
334264
public function send(Request $request)
    {
        $response      = new DeleteIndexResponse();
        $rpbDeleteReq  = $this->createRpbMessage($request);

        $this->client->send($rpbDeleteReq, RiakMessageCodes::YOKOZUNA_INDEX_DELETE_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
979264
public function post(Request $request)
    {
        // Validate user
        $email = Arr::get($this->getContentAsArray($request), 'email');
        $user  = $this->userService->findByEmail($email);

        if (! $user) {
            return $this->createNotFoundResponse();
        }

        // If a token exists that won't expire in the next 5 minutes, send it
        $token = $this->userService->findTokenBy([
            'user_id'       => $user->getId(),
            'token_type_id' => TokenEntity::TYPE_RESET_PASSWORD,
            ['expires', '>', time() + 5*60],
        ]);

        // Otherwise create a new token
        if (! $token) {
            $token = $this->userService->createUserToken([
                'user_id'       => $user->getId(),
                'token_type_id' => TokenEntity::TYPE_RESET_PASSWORD,
                'expires'       => strtotime('+1 day', time()),
            ]);
        }

        $this->resetPasswordView->setUserToken($token);

        $email = $this->emailService->createFromArray([
            'recipient_email' => $user->getEmail(),
            'subject'         => 'Reset Your Password',
            'message'         => (string) $this->resetPasswordView,
        ]);

        $this->emailService->enqueueSendEmailJob($email);

        return $this->create204Response(204, '');
    }
335648
public function postLogin(Request $request)
    {
        $this->loginValidator($request->all())->validate();

        $credentials = $request->only([$this->username(), 'password']);
        $remember = $request->get('remember', false);

        if ($this->guard()->attempt($credentials, $remember)) {
            return $this->sendLoginResponse($request);
        }

        return back()->withInput()->withErrors([
            $this->username() => $this->getFailedLoginMessage(),
        ]);
    }
565032
public function listAction(Request $request)
    {
        $pager = $this->get('lexik_mailer.simple_pager')->retrievePageElements(
            $this->container->getParameter('lexik_mailer.email_entity.class'),
            $request->get('page', 1)
        );

        return $this->render('LexikMailerBundle:Email:list.html.twig', array_merge(array(
            'emails'  => $pager->getResults(),
            'total'   => $pager->getCount(),
            'page'    => $pager->getPage(),
            'maxPage' => $pager->getMaxPage(),
            'layout'  => $this->container->getParameter('lexik_mailer.base_layout'),
            'locale'  => $this->container->getParameter('locale'),
        ), $this->getAdditionalParameters()));
    }
1369548
public function sendRequest(Request $request)
    {

        $result = $this->responseFactory->create();
        $client = $this->httpClientFactory->create();

        $apiData = $request->getApiData();
        $apiUrl = $request->getApiUrl();
        $apiKey = $request->getApiKey();
        $requestMethod = $request->getRequestMethod();

        $requestData = $requestMethod !== "GET" ? json_encode($apiData, JSON_UNESCAPED_SLASHES) : null;

        $client->setUri($apiUrl);

        $client->setConfig(['maxredirects' => 0, 'timeout' => 30]);

        $headers =  [
            'User-Agent'            => 'BoltPay/Magento-'.$this->configHelper->getStoreVersion() . '/' . $this->configHelper->getModuleVersion(),
            'X-Bolt-Plugin-Version' => $this->configHelper->getModuleVersion(),
            'Content-Type'          => 'application/json',
            'Content-Length'        => $requestData ? strlen($requestData) : null,
            'X-Api-Key'             => $apiKey,
            'X-Nonce'               => rand(100000000000, 999999999999)
        ] + (array)$request->getHeaders();

        $request->setHeaders($headers);

        $this->bugsnag->registerCallback(function ($report) use ($request) {
            $report->setMetaData([
                'BOLT API REQUEST' => $request->getData()
            ]);
        });

        $client->setHeaders($headers);

        $responseBody = null;

        try {
            $response     = $client->setRawData($requestData, 'application/json')->request($requestMethod);
            $responseBody = $response->getBody();

            $this->bugsnag->registerCallback(function ($report) use ($response) {
                $report->setMetaData([
                    'BOLT API RESPONSE' => [
                        'headers' => $response->getHeaders(),
                        'body'    => $response->getBody(),
                    ]
                ]);
            });

            $this->bugsnag->registerCallback(function ($report) use ($response) {
                $headers = $response->getHeaders();
                $report->setMetaData([
                    'META DATA' => [
                        'bolt_trace_id' => @$headers[ConfigHelper::BOLT_TRACE_ID_HEADER],
                    ]
                ]);
            });
        } catch (\Exception $e) {
            throw new LocalizedException($this->wrapGatewayError($e->getMessage()));
        }

        if ($request->getStatusOnly() && $response) {
            return $response->getStatus();
        }

        if ($responseBody) {
            $resultFromJSON = json_decode($responseBody);
            $jsonError  = $this->handleJsonParseError();
            if ($jsonError != null) {
                $message = __("JSON Parse Error: " . $jsonError);
                throw new LocalizedException($message);
            }

            if ($this->isResponseError($resultFromJSON)) {
                $message = isset($resultFromJSON->errors[0]->message) ? __($resultFromJSON->errors[0]->message) :  __("Bolt API Error Response");
                throw new LocalizedException($message);
            }

            $result->setResponse($resultFromJSON);
        } else {
            throw new LocalizedException(
                __('Something went wrong in the payment gateway.')
            );
        }
        return $result;
    }