From b371c702203a3817607bafd3bfaea7de566835fb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 18 Jun 2019 14:17:43 -0600 Subject: [PATCH] Update ContactController --- app/Http/Controllers/ContactController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index da1591fe..5b8801d1 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -10,11 +10,13 @@ class ContactController extends Controller { public function show(Request $request) { + abort_if(!config('instance.contact.enabled'), 404); return view('site.contact'); } public function store(Request $request) { + abort_if(!config('instance.contact.enabled'), 404); abort_if(!Auth::check(), 403); $this->validate($request, [ @@ -26,8 +28,9 @@ class ContactController extends Controller $request_response = $request->input('request_response') == 'on' ? true : false; $user = Auth::user(); + $max = config('instance.contact.max_per_day'); $contact = Contact::whereUserId($user->id) - ->whereDate('created_at', '>', now()->subDays(1)) + ->whereDate('created_at', '>', now()->subDays($max)) ->count(); if($contact >= 2) {