added contact us page
This commit is contained in:
@@ -14,11 +14,16 @@ use App\Models\user\UserModel;
|
|||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Analytics;
|
use Analytics;
|
||||||
use App\Models\TemplatesModel;
|
use App\Models\TemplatesModel;
|
||||||
|
use App\Traits\CaptchaTrait;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
|
||||||
class TeamStoreController extends Controller
|
class TeamStoreController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
use CaptchaTrait;
|
||||||
|
|
||||||
public function index(Request $request, $teamStoreURL)
|
public function index(Request $request, $teamStoreURL)
|
||||||
{
|
{
|
||||||
// var_dump($teamStoreURL);
|
// var_dump($teamStoreURL);
|
||||||
@@ -819,4 +824,61 @@ class TeamStoreController extends Controller
|
|||||||
return view('merchbay.templates')
|
return view('merchbay.templates')
|
||||||
->with('row', $data);
|
->with('row', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function contactUsSend(Request $request) {
|
||||||
|
$post = $request->all();
|
||||||
|
|
||||||
|
$post['captcha'] = $this->captchaCheck();
|
||||||
|
|
||||||
|
$validator = Validator::make(
|
||||||
|
$post,
|
||||||
|
[
|
||||||
|
'emailAddress' => 'required',
|
||||||
|
'fullname' => 'required',
|
||||||
|
'message' => 'required',
|
||||||
|
'g-recaptcha-response' => 'required',
|
||||||
|
'captcha' => 'required|min:1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'g-recaptcha-response.required' => 'Captcha is required',
|
||||||
|
'captcha.min' => 'Wrong captcha, please try again.'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
$errors = "";
|
||||||
|
foreach ($validator->errors()->all() as $error) {
|
||||||
|
$errors .= "<li>" . $error . "</li>";
|
||||||
|
}
|
||||||
|
$message = '
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
<strong>Error!</strong>' . $errors .
|
||||||
|
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>';
|
||||||
|
Session::flash('contactUserError', $message);
|
||||||
|
return Redirect::back();
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'name' => $post['fullname'],
|
||||||
|
'emailAddress' => $post['emailAddress'],
|
||||||
|
'msg' => $post['message'],
|
||||||
|
'receiver' => 'orders@merchbay.com',
|
||||||
|
'email_cc' => ['webmaster@merchbay.com','angelo@merchbay.com'],
|
||||||
|
'subject' => 'Merchbay - Contact Us Page',
|
||||||
|
);
|
||||||
|
|
||||||
|
Mail::send('emails.contact_us', $data, function ($msg) use ($data) {
|
||||||
|
$msg->from('support@merchbay.com', 'Merchbay Contact Us Page');
|
||||||
|
$msg->bcc($data['email_cc'], 'Merchbay Contact Us Page');
|
||||||
|
$msg->to($data['receiver'])->subject($data['subject']);
|
||||||
|
});
|
||||||
|
|
||||||
|
$contactUsUrl = url('/contact-us');
|
||||||
|
echo '<script>
|
||||||
|
alert("Your message is successfully sent.");
|
||||||
|
window.location = "'. $contactUsUrl .'"
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,8 @@ Route::post('/custom/register', 'CustomAuthController@postRegister');
|
|||||||
Route::get('cart', ['as' => 'cart', 'uses' => 'teamstore\TeamStoreController@cart']);
|
Route::get('cart', ['as' => 'cart', 'uses' => 'teamstore\TeamStoreController@cart']);
|
||||||
Route::get('/checkout', 'teamstore\TeamStoreController@checkout');
|
Route::get('/checkout', 'teamstore\TeamStoreController@checkout');
|
||||||
Route::get('/contact-us', 'teamstore\TeamStoreController@contact');
|
Route::get('/contact-us', 'teamstore\TeamStoreController@contact');
|
||||||
|
Route::post('/contact-us/send', 'teamstore\TeamStoreController@contactUsSend');
|
||||||
|
|
||||||
Route::get('/mail', 'teamstore\TeamStoreController@mail');
|
Route::get('/mail', 'teamstore\TeamStoreController@mail');
|
||||||
|
|
||||||
Route::get('/designer/{templateid}', 'designer\DesignerController@index');
|
Route::get('/designer/{templateid}', 'designer\DesignerController@index');
|
||||||
|
|||||||
@@ -20,15 +20,41 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col col-lg-5">
|
<div class="col col-lg-5">
|
||||||
<h6><i class="fa fa-envelope-square me-2"></i> Email Address:</h6>
|
|
||||||
|
<h6><i class="fa fa-map-marker me-2"></i>Address:</h6>
|
||||||
|
<p>1281 Humbracht Circle Suite J Bartlett, Illinois 60103</p>
|
||||||
|
<hr>
|
||||||
|
{{-- <h6><i class="fa fa-envelope-square me-2"></i> Email Address:</h6>
|
||||||
<p>orders@merchbay.com</p>
|
<p>orders@merchbay.com</p>
|
||||||
<hr>
|
<hr>
|
||||||
<h6><i class="fa fa-phone-square me-2"></i>Contact Number:</h6>
|
<h6><i class="fa fa-phone-square me-2"></i>Contact Number:</h6>
|
||||||
<p>630 213 1500</p>
|
<p>630 213 1500</p>
|
||||||
<hr>
|
<hr>
|
||||||
<h6><i class="fa fa-map-marker me-2"></i>Address:</h6>
|
<h6><i class="fa fa-map-marker me-2"></i>Address:</h6>
|
||||||
<p>1281 Humbracht Circle Suite J Bartlett, Illinois 60103</p>
|
<p>1281 Humbracht Circle Suite J Bartlett, Illinois 60103</p> --}}
|
||||||
|
@if(Session::has('contactUserError'))
|
||||||
|
{!! Session::get('contactUserError') !!}
|
||||||
|
@endif
|
||||||
|
<form action="{{ url('contact-us/send') }}" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
|
<label for="emailAddress" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control" name="emailAddress" placeholder="Email Address" required>
|
||||||
|
<div class="form-text">We'll never share your email with anyone else.</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="fullname" class="form-label">Fullname</label>
|
||||||
|
<input type="text" class="form-control" placeholder="Fullname" name="fullname" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="message" class="form-label">Message</label>
|
||||||
|
<textarea class="form-control" rows="5" name="message" placeholder="Message"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="g-recaptcha text-center" data-sitekey="{{ env('CAPTCHA_SITE_KEY') }}"></div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-black">Submit</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
25
resources/views/emails/contact_us.blade.php
Normal file
25
resources/views/emails/contact_us.blade.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Merchbay | Contact Us</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Merchbay - Contact Page</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Name</strong><br><?php echo $name; ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Email Address</strong><br><?php echo $emailAddress; ?>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Message</strong><br><?php echo $msg; ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user