/** * 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'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $contacts = Contact::latest()->get(); return view('admin.contacts.index', compact('contacts')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $contacts = Contact::latest('created_at')->with('addr')->paginate(10); return view('contacts.index', compact('contacts')); }