diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index da1591fe3..5b8801d17 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) {