Skip to content

Instantly share code, notes, and snippets.

@ganeshaampuh
Created March 15, 2018 08:30
Show Gist options
  • Select an option

  • Save ganeshaampuh/ceb35fd8b03ec766167e847b41d9cc6e to your computer and use it in GitHub Desktop.

Select an option

Save ganeshaampuh/ceb35fd8b03ec766167e847b41d9cc6e to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use App\Mail\ContactUs;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Models\ContactUs as Contact;
class ContactController extends Controller
{
public function store(Request $request)
{
if ($request->ajax()) {
$data = $request->all();
$mail = Mail::to('contact@telonlang.com')->send(new ContactUs($data));
$mailtodb = Contact::create($data);
return response()->json(['status' => 'success','msg' => 'Mail has been Sent']);
} else {
return 'no';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment