/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('name', 'email', 'subject', 'body', 'g-recaptcha-response'); $this->contactForm->validate($input); // $this->mailer->sendMessage([ // 'fromName' => e($input['name']), // 'fromEmail' => $input['email'], // 'subject' => e($input['subject']), // 'body' => e($input['body']), // 'ip' => Request::ip(), // ]); ContactMessage::create(['name' => e($input['name']), 'email' => $input['email'], 'subject' => e($input['subject']), 'message' => e($input['body']), 'user_id' => Auth::check() ? Auth::id() : null, 'county_id' => config('app.county')]); flash('Mesajul a fost trimis.'); return json(true); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { with(ContactMessage::findOrFail($id))->delete(); return json(1); }