Update ContactController

This commit is contained in:
Daniel Supernault 2019-06-18 14:17:43 -06:00
parent 157a03f13d
commit b371c70220
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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) {