⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
wearecrazy
/
public_html
/
@core
/
app
/
Helpers
/
View File Name :
FormBuilderHelpers.php
<?php namespace App\Helpers; use Dotenv\Validator; use Illuminate\Support\Str; class FormBuilderHelpers { public static function filter_form_field($request) { unset($request['_token']); $all_fields_name = []; $all_request_except_token = $request->all(); foreach ($request->field_name as $fname) { $all_fields_name[] = strtolower(Str::slug($fname)); } $all_request_except_token['field_name'] = $all_fields_name; $json_encoded_data = json_encode($all_request_except_token); return $json_encoded_data; } public static function get_filtered_data_from_request($option_value,$request){ $all_attachment = []; $all_quote_form_fields = (array) json_decode($option_value); $all_field_type = isset($all_quote_form_fields['field_type']) ? (array) $all_quote_form_fields['field_type'] : []; $all_field_name = isset($all_quote_form_fields['field_name']) ? $all_quote_form_fields['field_name'] : []; $all_field_required = isset($all_quote_form_fields['field_required']) ? (object) $all_quote_form_fields['field_required'] : []; $all_field_mimes_type = isset($all_quote_form_fields['mimes_type']) ? (object) $all_quote_form_fields['mimes_type'] : []; //get field details from, form request $all_field_serialize_data = $request->all(); unset($all_field_serialize_data['_token']); if (isset($all_field_serialize_data['captcha_token'])){ unset($all_field_serialize_data['captcha_token']); } if (!empty($all_field_name)){ foreach ($all_field_name as $index => $field){ $is_required = !empty($all_field_required) && property_exists($all_field_required,$index) ? $all_field_required->$index : ''; $mime_type = !empty($all_field_mimes_type) && property_exists($all_field_mimes_type,$index) ? $all_field_mimes_type->$index : ''; $field_type = isset($all_field_type[$index]) ? $all_field_type[$index] : ''; if (!empty($field_type) && $field_type == 'file'){ unset($all_field_serialize_data[$field]); } $validation_rules = !empty($is_required) ? 'required|': ''; $validation_rules .= !empty($mime_type) ? $mime_type : ''; //validate field Validator::make($request,[ $field => $validation_rules ]); if ($field_type == 'file' && $request->hasFile($field)) { $filed_instance = $request->file($field); $file_extenstion = $filed_instance->getClientOriginalExtension(); $attachment_name = 'attachment-'.Str::random(32).'-'. $field .'.'. $file_extenstion; $filed_instance->move('assets/uploads/attachment/applicant', $attachment_name); $all_attachment[$field] = 'assets/uploads/attachment/applicant/' . $attachment_name; } } } return [ 'all_attachment' => $all_attachment, 'field_data' => $all_field_serialize_data ]; } }