diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index b3351a3..ab51919 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Response; use JeroenDesloovere\VCard\VCard; use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Validator; +use Illuminate\Support\Facades\Mail; +use App\Mail\ReportSubmissionMail; use Auth; use DB; @@ -1160,6 +1162,20 @@ class UserController extends Controller } + // Hanle reports + function report(Request $request) + { + $formData = $request->all(); + + try { + Mail::to(env('ADMIN_EMAIL'))->send(new ReportSubmissionMail($formData)); + + return redirect('report')->with('success', __('messages.report_success')); + } catch (\Exception $e) { + return redirect()->back()->with('error', __('messages.report_error')); + } + } + //Edit/save page icons public function editIcons(request $request) { diff --git a/app/Mail/ReportSubmissionMail.php b/app/Mail/ReportSubmissionMail.php new file mode 100644 index 0000000..d2c67e3 --- /dev/null +++ b/app/Mail/ReportSubmissionMail.php @@ -0,0 +1,28 @@ +formData = $formData; + } + + public function build() + { + return $this->view('layouts.send-report') + ->subject(__('messages.report_mail_admin_subject')); + } +} \ No newline at end of file diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 1b40b89..3da9fd8 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -1039,6 +1039,53 @@ return [ 'footer.Contact' => 'Contact', + /* + |-------------------------------------------------------------------------- + | Report Page + |-------------------------------------------------------------------------- + | + */ + + 'report_violation' => 'Report a Violation', + 'url_label' => 'URL of the site you are reporting', + 'report_type_label' => 'Type of report', + 'hate_speech' => 'Hate Speech or Harassment', + 'violence_threats' => 'Violence or Threats', + 'illegal_activities' => 'Illegal Activities', + 'copyright_infringement' => 'Copyright Infringement', + 'misinformation_fake_news' => 'Misinformation or Fake News', + 'identity_theft' => 'Identity Theft', + 'drug_related_content' => 'Drug-related Content', + 'weapons_harmful_objects' => 'Weapons or Harmful Objects', + 'child_exploitation' => 'Child Exploitation', + 'fraud_scams' => 'Fraud or Scams', + 'privacy_violation' => 'Privacy Violation', + 'impersonation' => 'Impersonation', + 'other_specify' => 'Other (Specify)', + 'additional_comments_label' => 'Additional comments', + 'submit_button' => 'Submit', + + + 'report_mail_admin_subject' => 'Profile Report', + 'report_mail_admin_report' => 'A Profile has been reported', + + 'report_mail_reported_profile' => 'Reported Profile', + 'report_mail_reported_url' => 'Reported URL', + 'report_mail_type' => 'Type', + 'report_mail_message' => 'Message', + + 'report_mail_report_submitted_by' => 'Report submitted by', + 'report_mail_reported_by' => 'Reported by', + 'report_mail_profile' => 'Profile', + + 'report_mail_button_profile' => 'View on Users Page', + 'report_mail_button_delete' => 'Delete Reported User', + + + 'report_error' => 'Profile could not be reported', + 'report_success' => 'Profile has been reported successfully', + + #=============================================================================# # Laravel internal translations # #=============================================================================# diff --git a/resources/views/layouts/send-report.blade.php b/resources/views/layouts/send-report.blade.php new file mode 100644 index 0000000..a8428e0 --- /dev/null +++ b/resources/views/layouts/send-report.blade.php @@ -0,0 +1,76 @@ + + +
+ + + + + + +