original_string: public function run(array $notification, array $variables = null, array $recipients = null)
      {
          $typeName = Arr::get($notification, 'type.name');
  
          switch ($typeName) {
              case 'email':
                  $instance = app(EmailNotification::class);
                  break;
              case 'sms':
                  $instance = app(SmsNotification::class);
                  break;
              default:
                  $instance = app(CustomNotification::class);
                  break;
          }
          $instance->setPredefinedVariables($variables);
          $instance->setModel($notification);
  
          if ($instance instanceof SendableNotification) {
              $instance->setRecipients($recipients);
  
              if (!$this->validate($instance)) {
                  return false;
              }
              $type = $instance->getType();
              $job  = $instance->onConnection('database')->onQueue($type);
              $this->dispatch($job);
          } else {
              return $instance->handle();
          }
      }
code: public function run(array $notification, array $variables = null, array $recipients = null)
      {
          $typeName = Arr::get($notification, 'type.name');
  
          switch ($typeName) {
              case 'email':
                  $instance = app(EmailNotification::class);
                  break;
              case 'sms':
                  $instance = app(SmsNotification::class);
                  break;
              default:
                  $instance = app(CustomNotification::class);
                  break;
          }
          $instance->setPredefinedVariables($variables);
          $instance->setModel($notification);
  
          if ($instance instanceof SendableNotification) {
              $instance->setRecipients($recipients);
  
              if (!$this->validate($instance)) {
                  return false;
              }
              $type = $instance->getType();
              $job  = $instance->onConnection('database')->onQueue($type);
              $this->dispatch($job);
          } else {
              return $instance->handle();
          }
      }
code_tokens: public function run ( array $ notification , array $ variables = null , array $ recipients = null ) { $ typeName = Arr :: get ( $ notification , 'type.name' ) ; switch ( $ typeName ) { case 'email' : $ instance = app ( EmailNotification :: class ) ; break ; case 'sms' : $ instance = app ( SmsNotification :: class ) ; break ; default : $ instance = app ( CustomNotification :: class ) ; break ; } $ instance -> setPredefinedVariables ( $ variables ) ; $ instance -> setModel ( $ notification ) ; if ( $ instance instanceof SendableNotification ) { $ instance -> setRecipients ( $ recipients ) ; if ( ! $ this -> validate ( $ instance ) ) { return false ; } $ type = $ instance -> getType ( ) ; $ job = $ instance -> onConnection ( 'database' ) -> onQueue ( $ type ) ; $ this -> dispatch ( $ job ) ; } else { return $ instance -> handle ( ) ; } }
docstring: Sends notification.
  
  @param array $notification
  @param array|null $variables
  @param array|null $recipients
  @return bool|\Symfony\Component\HttpFoundation\Response
docstring_tokens: Sends notification .