/**
  * This method will setup tokens specific to letting support know a new question has been asked.
  */
 protected function addAdditionalTokens()
 {
     $this->tokenDefinitions['CUSTOMER_NAME'] = function () {
         return $this->question->getUser()->getPerson()->getNameFirstLast();
     };
     $this->tokenDefinitions['COMPANY_NAME'] = function () {
         $person = $this->question->getUser()->getPerson();
         $employeeRecord = $person->getEmployee();
         return $employeeRecord !== null ? $employeeRecord->getCompany()->getName() : '';
     };
     $this->tokenDefinitions['EMAIL_ADDRESS'] = function () {
         return $this->question->getUser()->getPerson()->getPrimaryEmailAddress();
     };
     $this->tokenDefinitions['QUESTION'] = function () {
         return $this->question->getQuestion();
     };
 }
 /**
  * This method will make sure the actual question text will get sent to Mongo for us to remember.
  *
  * @param Request $request
  * @param Question $question
  */
 protected function afterSave(Question $question)
 {
     $request = $this->getRequest();
     $post = json_decode($request->getContent());
     $question->setQuestion($post->QuestionText);
     $question->save();
     // Let the support team know that a customer has a question
     $newQuestionNotification = Factory::createNewObject(NewQuestion::class, [$question]);
     $newQuestionNotification->send();
     return $question;
 }