public function postContact()
 {
     $formData = array('sender_name_surname' => Input::get('sender_name_surname'), 'sender_email' => Input::get('sender_email'), 'sender_phone_number' => Input::get('sender_phone_number'), 'subject' => Input::get('subject'), 'post' => Input::get('message'));
     $rules = array('sender_name_surname' => 'required', 'sender_email' => 'required|email', 'sender_phone_number' => 'required', 'subject' => 'required', 'post' => 'required');
     $validation = Validator::make($formData, $rules);
     if ($validation->fails()) {
         return Redirect::action('FormPostController@getContact')->withErrors($validation)->withInput();
     }
     /*
     Mail::send('emails.contact-form.form', $formData, function ($message) {
         $message->from(Input::get('sender_email'), Input::get('sender_name_surname'));
         $message->to('*****@*****.**', 'Lorem Lipsum')->subject(Input::get('subject'));
     });
     */
     /*
     $mailer = new Mailer;
     $mailer->send('emails.contact-form.form', '*****@*****.**', Input::get('subject'), $formData);
     */
     $formPost = new FormPost();
     $formPost->sender_name_surname = $formData['sender_name_surname'];
     $formPost->sender_email = $formData['sender_email'];
     $formPost->sender_phone_number = $formData['sender_phone_number'];
     $formPost->subject = $formData['subject'];
     $formPost->message = $formData['post'];
     $formPost->lang = getLang();
     $formPost->save();
     return Redirect::action('FormPostController@getContact')->with('message', 'Success');
 }
 public function toggleAnswer($id)
 {
     $formPost = FormPost::findOrFail($id);
     $formPost->is_answered = $formPost->is_answered ? false : true;
     $formPost->save();
     return Response::json(array('result' => 'success', 'changed' => $formPost->is_answered ? 1 : 0));
 }
Exemple #3
0
 /**
  * @param $view
  */
 public function compose($view)
 {
     $view->with('formPost', FormPost::where('is_answered', 0)->get());
 }