diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 3a093fe..823060f 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -20,7 +20,7 @@ use Mail; use App\Models\User; use App\Models\Partner; use PDF; -use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; class HomeController extends Controller { @@ -60,11 +60,11 @@ class HomeController extends Controller return view('ndis-scheme'); } public function contact(){ - // $services = Service::where('status',1)->get(); + $services = Service::where('status',1)->get(); $phone = Setting::where(['key' => 'phone','status' => '1'])->first(); $email = Setting::where(['key' => 'email','status' => '1'])->first(); $address = Setting::where(['key' => 'address','status' => '1'])->first(); - return view('contact',compact('phone','email','address')); + return view('contact',compact('phone','email','address','services')); } public function accommodation_details($id){ @@ -73,11 +73,18 @@ class HomeController extends Controller } public function send_contact_mail(Request $request){ + $this->validate(\request(),[ + 'fullname' => 'required', + 'phone' => 'required', + 'email' => 'required', + 'service_id' => 'required|numeric', + 'entered_captcha_code' => 'required|same:displayed_captcha_code' + ]); $contact = new Contact(); $subject = 'Quick Enquiry'; $check = ''; - if(isset($request['firstname'])){ - $subject = 'Quick Enquiry'; + if(isset($request['check'])){ + $subject = 'Contact Enquiry'; $check = '1'; } $name = ($request['firstname'] != null) ? ($request['firstname'].' '.$request['lastname']) : $request['fullname'] ; @@ -306,5 +313,10 @@ class HomeController extends Controller // $services = Service::where('status',1)->get(); return view('blog.single',compact('blog')); } + + public function refreshCaptcha() + { + return response()->json(['captcha_code'=> Str::random(5)]); + } } diff --git a/resources/views/contact.blade.php b/resources/views/contact.blade.php index b7d83d9..2d196e9 100644 --- a/resources/views/contact.blade.php +++ b/resources/views/contact.blade.php @@ -3,6 +3,7 @@