/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // get all the contacts $contacts = Contact::all(); // load the view and pass the contacts return \View::make('admin.pages.contacts.index')->with('contacts', $contacts); // }
public function getContactUsForm() { //Get all the data and store it inside Store Variable $data = Input::all(); //Validation rules $rules = array('name' => 'required', 'email' => 'required|email', 'str_message' => 'required|min:5'); //Validate data $validator = Validator::make($data, $rules); //If everything is correct than run passes. if ($validator->passes()) { // get all the Contact $contacts = Contact::all(); Mail::send('pages.emails.feedback', $data, function ($message) use($data, $contacts) { //$message->from($data['email'] , $data['name']); //uncomment if using first name and email fields //email 'To' field: cahnge this to emails that you want to be notified. $message->from($contacts->first()->email, 'feedback contact form'); $message->to($contacts->first()->email, 'feedback')->subject('feedback form submit')->cc('*****@*****.**'); }); // Redirect to page return Redirect::to('/')->with('message', 'Your message has been sent. Thank You!'); //return View::make('contact'); } else { //return contact form with errors return Redirect::to('/')->with('error', 'Feedback must contain more than 5 characters. Try Again.'); } }