コード例 #1
0
ファイル: Form.php プロジェクト: web-feet/coasterframework
 /**
  * Send the form data by email
  * @param array $formData
  * @param \stdClass $form_settings
  * @return boolean
  */
 public function submissionSendEmail(array $formData, \stdClass $form_settings)
 {
     $subject = config('coaster::site.name') . ': New Form Submission - ' . $this->_block->label;
     return Email::sendFromFormData([$form_settings->template], $formData, $subject, $form_settings->email_to, $form_settings->email_from);
 }
コード例 #2
0
 /**
  * Repeater form submission
  * @param array $formData
  * @return null|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function submission($formData)
 {
     $formRules = BlockFormRule::get_rules($this->_block->name . '-form');
     $v = Validator::make($formData, $formRules);
     if ($v->passes()) {
         foreach ($formData as $blockName => $content) {
             $fieldBlock = Block::preload($blockName);
             if ($fieldBlock->exists) {
                 if ($fieldBlock->type == 'datetime' && empty($content)) {
                     $content = new Carbon();
                 }
                 $formData[$blockName] = $content;
             }
         }
         $this->insertRow($formData);
         Email::sendFromFormData([$this->_block->name . '-form'], $formData, config('coaster::site.name') . ': New Form Submission - ' . $this->_block->label);
         return \redirect(Request::url());
     } else {
         FormMessage::set($v->messages());
     }
     return null;
 }