/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // delete $contact = Contact::find($id); $contact->delete(); // redirect \Session::flash('message', 'Successfully deleted the contact!'); return \Redirect::to('admin/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.'); } }