public function admin()
 {
     $page = get_page_contents();
     $user = Auth::user();
     $emails = AdminEmail::all();
     return view('pages.admin', compact('user', 'page', 'emails'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(ContactFormRequest $request)
 {
     // return var_dump($request->get('email'));
     // $user = $request->all();
     Mail::send('emailtemplates.contactform', array('name' => $request->get('name'), 'email' => $request->get('email'), 'user_message' => $request->get('message')), function ($message) {
         $user_email = AdminEmail::where('role', '=', 'contact_form')->first();
         $message->from('*****@*****.**');
         $message->to($user_email->email)->subject('RBE Contact Message');
     });
     return redirect('contact')->with('message', 'Thanks for contacting us!');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(VolunteerFormRequest $request)
 {
     $data = $request->all();
     foreach ($data as $i => $item) {
         if (is_array($item)) {
             $data[$i] = serialize($item);
         }
     }
     Volunteer::create($data);
     Mail::send('emailtemplates.volunteerform', $data, function ($message) {
         $volunteer_email = AdminEmail::where('role', '=', 'volunteer_form')->first();
         //$volunteer_email = '*****@*****.**';
         $message->from('*****@*****.**');
         $message->to($volunteer_email->email)->subject('RBE Volunteer Form');
     });
     return redirect('/volunteer')->with('message', 'Thank you for your interest in volunteering!');
 }
 public function update(EmailRequest $request, $id)
 {
     $email = $request->all();
     AdminEmail::findOrFail($id)->update(['email' => $email['email']]);
     return redirect('/admin');
 }