55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
||
|
||
namespace App\Http\Controllers;
|
||
|
||
use Illuminate\Http\Request;
|
||
use \App\Http\Requests\SupportTechnicalRequest;
|
||
use Carbon\Carbon;
|
||
use Illuminate\Support\Facades\Mail;
|
||
use App\Mail\CustomerServiceMail;
|
||
|
||
class SupportTechnicalController extends Controller
|
||
{
|
||
public function index()
|
||
{
|
||
return view('support-technical');
|
||
}
|
||
|
||
public function indexPost(SupportTechnicalRequest $request)
|
||
{
|
||
\App\Models\SupportTechnical::insert([
|
||
'name_first' => $request->input('name_first'),
|
||
'name_last' => $request->input('name_last'),
|
||
'company_name' => $request->input('company_name'),
|
||
'job_title' => $request->input('job_title'),
|
||
'email' => $request->input('email'),
|
||
'phone' => $request->input('phone'),
|
||
'contry' => $request->input('contry'),
|
||
'comments' => $request->input('comments'),
|
||
'created_at' => Carbon::now(),
|
||
]);
|
||
|
||
try
|
||
{
|
||
$data = 'First Name: ' . $request->input('name_first') . "\n";
|
||
$data .= 'Last Name: ' . $request->input('name_last') . "\n";
|
||
$data .= 'Company Name: ' . $request->input('company_name') . "\n";
|
||
$data .= 'Job Title: ' . $request->input('job_title') . "\n";
|
||
$data .= 'Email: ' . $request->input('email') . "\n";
|
||
$data .= 'Phone: ' . $request->input('phone') . "\n";
|
||
$data .= 'Contry: ' . $request->input('contry') . "\n";
|
||
$data .= 'Comments: ' . $request->input('comments') . "\n";
|
||
$data .= 'Created At ' . Carbon::now() . "\n";
|
||
|
||
Mail::to('service.cri@coreality-inc.com')->send(
|
||
new CustomerServiceMail($data)
|
||
);
|
||
}
|
||
catch (Exception $ex)
|
||
{
|
||
|
||
}
|
||
return redirect()->back()->with('success', 'We have received your customer sercvice inquiry!');
|
||
}
|
||
}
|