⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
dalily.dev-unit.com
/
app
/
Services
/
View File Name :
SettingService.php
<?php /* * LaraClassifier - Classified Ads Web Application * Copyright (c) BeDigit. All Rights Reserved * * Website: https://laraclassifier.com * Author: Mayeul Akpovi (BeDigit - https://bedigit.com) * * LICENSE * ------- * This software is provided under a license agreement and may only be used or copied * in accordance with its terms, including the inclusion of the above copyright notice. * As this software is sold exclusively on CodeCanyon, * please review the full license details here: https://codecanyon.net/licenses/standard */ namespace App\Services; use App\Models\Setting; use Illuminate\Http\JsonResponse; class SettingService extends BaseService { /** * List settings * * @return \Illuminate\Http\JsonResponse */ public function getEntries(): JsonResponse { $settings = config('settings'); // Remove the 'purchase_code' value if (isset($settings['app'])) { $app = $settings['app']; if (isset($app['purchase_code'])) { unset($app['purchase_code']); $settings['app'] = $app; } } // Remove settings hidden values $settings = collect($settings) ->mapWithKeys(function ($value, $key) { $value = collect($value) ->reject(function ($v, $k) { return in_array($k, Setting::optionsThatNeedToBeHidden()); }); return [$key => $value]; })->reject(function ($v) { return (empty($v) || ($v->count() <= 0)); })->toArray(); $data = [ 'success' => true, 'result' => $settings, ]; return apiResponse()->json($data); } /** * Get setting * * @param string $key * @return \Illuminate\Http\JsonResponse */ public function getEntry(string $key): JsonResponse { $settingKey = 'settings.' . $key; if (!config()->has($settingKey)) { return apiResponse()->notFound(); } $settings = config($settingKey); // Remove the 'purchase_code' value if (is_array($settings)) { if (isset($settings['purchase_code'])) { unset($settings['purchase_code']); } } if (is_string($settings)) { if (str_ends_with($settingKey, 'purchase_code')) { $settings = null; } } // Remove settings hidden values if (is_array($settings)) { $settings = collect($settings) ->reject(function ($v, $k) { return in_array($k, Setting::optionsThatNeedToBeHidden()); })->toArray(); } if (is_string($settings)) { foreach (Setting::optionsThatNeedToBeHidden() as $hiddenValue) { if (str_ends_with($settingKey, $hiddenValue)) { $settings = null; break; } } } if (empty($settings)) { return apiResponse()->notFound(); } $data = [ 'success' => true, 'result' => $settings, ]; return apiResponse()->json($data); } }