public function saveContact(Request $req) { $Pesan = new Pesan(); $Pesan->nama = $req->nama; $Pesan->email = $req->email; $Pesan->subjek = $req->subject; $Pesan->pesan = $req->pesan; $Pesan->save(); }
/** * Fungsi untuk Save reply yang admin kirim * @param int $id */ public function saveEmail(Request $request) { $testing = Contact::latest()->first(); $pesan = new Pesan(); $pesan->email = $request->get('email'); $pesan->name = $request->get('name'); $pesan->message = $request->get('message'); $pesan->save(); $reply = Pesan::latest()->first(); Mail::send('emails.reply', ['reply' => $reply], function ($message) use($reply) { $message->to($reply->email)->subject('Membalas Pertanyaan Anda'); }); $user = Auth::user(); $contact = Contact::all(); $count = DB::table('pesans')->count(); $count2 = DB::table('contacts')->count(); return Redirect('admin')->with('user', 'contact', 'count', 'count2'); }
public function postKirim(Request $request) { $this->validate($request, ['email' => 'required|email|min:3', 'pesan' => 'required']); $JmlPesanTerkirim = Pesan::where('tipe', 'Keluar')->count(); $JmlPesanBaru = Pesan::where('tipe', 'Masuk')->where('baru', 1)->count(); // Kirim email $Set = DB::table('site_setting')->where('id', 1)->first(); $email_dari = $Set->email; $this->kirim_email($email_dari, $request->email, $request->subject, $request->pesan); $Pesan = new Pesan(); $Pesan->nama = "-"; $Pesan->email = $request->email; $Pesan->subjek = $request->subjek; $Pesan->pesan = $request->pesan; $Pesan->tipe = "Keluar"; $Pesan->baru = "0"; $Pesan->save(); $request->session()->flash('success', 'Pesan Anda telah dikirim'); return redirect(route('pesan', ['tipe' => "Keluar"])); }