mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update ContactController
This commit is contained in:
parent
157a03f13d
commit
b371c70220
1 changed files with 4 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue