芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/app/Traits/Processor.php
errors()->getMessages() as $index => $error) { $errors[] = ['error_code' => $index, 'message' => self::translate($error[0])]; } return $errors; } public function translate($key) { try { App::setLocale('en'); $lang_array = include(base_path('resources/lang/' . 'en' . '/lang.php')); $processed_key = ucfirst(str_replace('_', ' ', str_ireplace(['\'', '"', ',', ';', '<', '>', '?'], ' ', $key))); if (!array_key_exists($key, $lang_array)) { $lang_array[$key] = $processed_key; $str = "where('key_name', $key) ->where('settings_type', $settings_type)->first(); } catch (Exception $exception) { return new Setting(); } return (isset($config)) ? $config : null; } public function file_uploader(string $dir, string $format, $image = null, $old_image = null) { if ($image == null) return $old_image ?? 'def.png'; if (isset($old_image)) Storage::disk('public')->delete($dir . $old_image); $imageName = \Carbon\Carbon::now()->toDateString() . "-" . uniqid() . "." . $format; if (!Storage::disk('public')->exists($dir)) { Storage::disk('public')->makeDirectory($dir); } Storage::disk('public')->put($dir . $imageName, file_get_contents($image)); return $imageName; } public function payment_response($payment_info, $payment_flag): Application|JsonResponse|Redirector|RedirectResponse|\Illuminate\Contracts\Foundation\Application { $token_string = 'payment_method=' . $payment_info->payment_method . '&&transaction_reference=' . $payment_info->transaction_id; if (in_array($payment_info->payment_platform, ['web', 'app']) && $payment_info['external_redirect_link'] != null) { return redirect($payment_info['external_redirect_link'] . '?flag=' . $payment_flag . '&&token=' . base64_encode($token_string)); } return redirect()->route('payment-' . $payment_flag, ['token' => base64_encode($token_string)]); } }