Skip to content

Commit 9d8513e

Browse files
committed
Update Service Provider
1 parent a1e5484 commit 9d8513e

7 files changed

+78
-17
lines changed

src/Providers/CoderstmEventServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/* __________________________________________________
33
| Obfuscated by YAK Pro - Php Obfuscator 2.0.16 |
4-
| on 2025-03-25 17:32:48 |
4+
| on 2025-04-16 10:35:11 |
55
| GitHub: https://github.com/pk-fr/yakpro-po |
66
|__________________________________________________|
77
*/
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
/* __________________________________________________
33
| Obfuscated by YAK Pro - Php Obfuscator 2.0.16 |
4-
| on 2025-03-25 17:32:47 |
4+
| on 2025-04-16 10:35:11 |
55
| GitHub: https://github.com/pk-fr/yakpro-po |
66
|__________________________________________________|
77
*/
88
/*
99
1010
*/
11-
namespace Coderstm\Providers; use Coderstm\Models\Permission; use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; class CoderstmPermissionsServiceProvider extends ServiceProvider { public function register() { } public function boot() { try { goto d6Tp7; d6Tp7: Permission::get()->map(function ($permission) { Gate::define($permission->scope, function ($user) use($permission) { return $user->hasPermission($permission->scope); }); }); goto ChJX1; ChJX1: Blade::directive("\147\162\x6f\165\160", function ($group, $guard = "\165\163\145\x72\163") { return "\x69\146\50\x67\165\x61\162\x64\x28\51\40\75\x3d\x20{$guard}\40\46\x26\40\x75\163\145\162\50\51\55\x3e\x68\x61\163\x47\162\157\x75\160\50{$group}\51\51\x20\72"; }); goto Av3SN; Av3SN: Blade::directive("\x65\x6e\144\x67\x72\x6f\x75\x70", function ($group) { return "\145\x6e\144\x69\x66\x3b"; }); goto PCNzu; PCNzu: } catch (\Exception $e) { report($e); } } }
11+
namespace Coderstm\Providers; use Coderstm\Models\Permission; use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; class CoderstmPermissionsServiceProvider extends ServiceProvider { public function register() { } public function boot() { try { goto V8Kjt; V8Kjt: Permission::get()->map(function ($permission) { Gate::define($permission->scope, function ($user) use($permission) { return $user->hasPermission($permission->scope); }); }); goto gEwVd; dzcAW: Blade::directive("\145\x6e\x64\147\x72\x6f\165\x70", function ($group) { return "\145\156\x64\x69\146\73"; }); goto CPFJ5; gEwVd: Blade::directive("\x67\x72\157\165\160", function ($group, $guard = "\x75\163\145\x72\163") { return "\151\x66\50\x67\165\141\162\144\x28\51\40\75\x3d\40{$guard}\40\46\46\40\x75\163\145\x72\x28\51\55\x3e\150\x61\163\107\162\x6f\x75\160\50{$group}\51\51\x20\x3a"; }); goto dzcAW; CPFJ5: } catch (\Exception $e) { report($e); } } }

src/Providers/CoderstmServiceProvider.php

+2-2
Large diffs are not rendered by default.

src/Providers/License.php

+2-2
Large diffs are not rendered by default.
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
/* __________________________________________________
33
| Obfuscated by YAK Pro - Php Obfuscator 2.0.16 |
4-
| on 2025-03-25 17:32:47 |
4+
| on 2025-04-16 10:35:11 |
55
| GitHub: https://github.com/pk-fr/yakpro-po |
66
|__________________________________________________|
77
*/
88
/*
99
1010
*/
11-
namespace Coderstm\Providers; use Coderstm\Shortcodes as Component; use Illuminate\Support\ServiceProvider; use Vedmant\LaravelShortcodes\Facades\Shortcodes; class ShortcodeServiceProvider extends ServiceProvider { public function register() : void { } public function boot() : void { goto mAJj6; mAJj6: Shortcodes::add(["\x70\154\x61\156\163" => Component\Plans::class, "\x63\141\154\145\156\x64\x61\162" => Component\Calendar::class, "\x6f\160\x65\x6e\151\x6e\147\55\164\151\155\145\163" => Component\OpeningTimes::class, "\143\157\x6e\164\x61\x63\164\x2d\x66\157\162\155" => Component\ContactForm::class, "\142\x6c\157\147\163" => Component\Blogs::class, "\150\145\x61\x64\145\162" => Component\Header::class, "\x66\157\157\x74\x65\162" => Component\Footer::class, "\x6d\145\x6e\x75" => Component\Menu::class, "\143\157\x6d\x70\x61\x6e\x79\55\x61\x64\x64\162\145\x73\163" => Component\CompanyAddress::class, "\145\155\x61\151\154" => Component\Email::class, "\160\150\x6f\x6e\x65" => Component\Phone::class, "\163\x6f\x63\x69\x61\x6c\x73" => Component\Socials::class, "\142\154\157\147" => Component\Blog::class, "\162\145\143\145\x6e\164\x2d\x62\x6c\157\147\163" => Component\RecentBlogs::class, "\142\x6c\157\x67\55\x74\141\147\x73" => Component\BlogTags::class]); goto Kc2Q_; Slzgw: Shortcodes::add("\x70\x61\x67\145\55\x74\151\164\154\x65", function ($atts, $content, $tag, $manager) { return request()->input("\160\141\147\145\x2e\x74\x69\164\x6c\145"); }); goto NEtff; Kc2Q_: Shortcodes::add("\142\x6c\157\x67\x2d\164\151\x74\154\145", function ($atts, $content, $tag, $manager) { return request()->input("\142\x6c\x6f\147\56\x74\151\x74\x6c\145"); }); goto Slzgw; NEtff: } }
11+
namespace Coderstm\Providers; use Coderstm\Shortcodes as Component; use Illuminate\Support\ServiceProvider; use Vedmant\LaravelShortcodes\Facades\Shortcodes; class ShortcodeServiceProvider extends ServiceProvider { public function register() : void { } public function boot() : void { goto hd9XF; SPNPC: Shortcodes::add("\160\x61\147\x65\55\x74\x69\164\x6c\145", function ($atts, $content, $tag, $manager) { return request()->input("\160\141\147\145\56\164\x69\164\x6c\145"); }); goto x8l5o; hd9XF: Shortcodes::add(["\x70\x6c\x61\156\163" => Component\Plans::class, "\143\141\154\x65\156\144\x61\x72" => Component\Calendar::class, "\157\160\145\156\x69\156\x67\x2d\164\151\x6d\145\163" => Component\OpeningTimes::class, "\143\157\x6e\x74\x61\143\164\x2d\146\x6f\162\x6d" => Component\ContactForm::class, "\x62\154\x6f\x67\163" => Component\Blogs::class, "\150\145\141\144\x65\162" => Component\Header::class, "\x66\x6f\x6f\x74\x65\162" => Component\Footer::class, "\x6d\145\x6e\165" => Component\Menu::class, "\143\157\155\x70\141\156\x79\x2d\x61\144\144\162\145\x73\x73" => Component\CompanyAddress::class, "\x65\x6d\141\x69\154" => Component\Email::class, "\160\150\x6f\x6e\x65" => Component\Phone::class, "\163\x6f\143\x69\141\x6c\163" => Component\Socials::class, "\142\x6c\157\147" => Component\Blog::class, "\162\145\x63\145\x6e\164\55\142\x6c\157\x67\163" => Component\RecentBlogs::class, "\142\x6c\157\147\55\x74\141\x67\163" => Component\BlogTags::class]); goto pCJIp; pCJIp: Shortcodes::add("\142\154\157\147\x2d\164\151\x74\x6c\145", function ($atts, $content, $tag, $manager) { return request()->input("\142\154\157\147\x2e\164\x69\x74\x6c\x65"); }); goto SPNPC; x8l5o: } }
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
/* __________________________________________________
33
| Obfuscated by YAK Pro - Php Obfuscator 2.0.16 |
4-
| on 2025-03-25 17:32:48 |
4+
| on 2025-04-16 10:35:11 |
55
| GitHub: https://github.com/pk-fr/yakpro-po |
66
|__________________________________________________|
77
*/
88
/*
99
1010
*/
11-
namespace Coderstm\Providers; use Coderstm\Services\Mix; use Coderstm\Services\Theme; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Coderstm\Services\MaskSensitiveConfig; use Coderstm\Http\Middleware\RequestThemeMiddleware; class ThemeServiceProvider extends ServiceProvider { public function register() : void { $this->app->singleton(Mix::class); $this->app->singleton("\x62\154\141\144\x65\x2e\x63\157\155\x70\151\154\145\162", function () { return new MaskSensitiveConfig($this->app["\146\151\x6c\145\x73"], $this->app["\143\x6f\x6e\146\151\147"]["\x76\151\145\x77\56\x63\157\155\x70\151\154\x65\144"]); }); } public function boot() : void { goto jqVK5; M9KRZ: fy8Q6: goto Fvd0r; HftJ7: $kernel->pushMiddleware(RequestThemeMiddleware::class); goto dIIu6; Fvd0r: $kernel = $this->app->make("\111\154\x6c\x75\x6d\x69\156\141\164\x65\134\x43\x6f\x6e\164\x72\141\143\x74\x73\x5c\110\164\x74\x70\134\x4b\145\162\156\x65\154"); goto HftJ7; jqVK5: if (!($theme = settings("\x74\x68\x65\155\145", "\141\143\164\151\x76\145"))) { goto fy8Q6; } goto ldF32; ldF32: Theme::set($theme); goto M9KRZ; dIIu6: } }
11+
namespace Coderstm\Providers; use Coderstm\Services\Mix; use Coderstm\Services\Theme; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Coderstm\Services\MaskSensitiveConfig; use Coderstm\Http\Middleware\RequestThemeMiddleware; class ThemeServiceProvider extends ServiceProvider { public function register() : void { $this->app->singleton(Mix::class); $this->app->singleton("\x62\x6c\x61\x64\145\56\x63\x6f\155\160\x69\x6c\x65\162", function () { return new MaskSensitiveConfig($this->app["\x66\x69\154\145\163"], $this->app["\x63\x6f\x6e\146\x69\147"]["\x76\151\145\167\x2e\x63\x6f\x6d\160\x69\154\145\144"]); }); } public function boot() : void { goto s0bN5; FgOvj: $kernel->pushMiddleware(RequestThemeMiddleware::class); goto ewMFa; znVG6: $kernel = $this->app->make("\111\154\154\x75\155\x69\156\x61\164\x65\134\x43\157\156\164\162\141\x63\x74\163\x5c\110\164\164\160\x5c\113\145\x72\x6e\145\154"); goto FgOvj; H6AJc: y7UYF: goto znVG6; s0bN5: if (!($theme = settings("\164\x68\x65\x6d\145", "\141\x63\x74\x69\x76\x65"))) { goto y7UYF; } goto tBggu; tBggu: Theme::set($theme); goto H6AJc; ewMFa: } }

src/Services/Helpers.php

+67-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Jenssegers\Agent\Agent;
88
use Coderstm\Models\Permission;
99
use Coderstm\Models\PaymentMethod;
10+
use Illuminate\Support\Facades\Cache;
1011
use Illuminate\Support\Facades\Config;
1112
use Stevebauman\Location\Facades\Location;
1213

@@ -34,6 +35,22 @@ public static function location()
3435
public static function loadConfigFromDatabase(...$keys): void
3536
{
3637
try {
38+
$cacheKey = 'app_config_' . md5(implode('_', $keys));
39+
$cacheDuration = 60; // Cache for 60 minutes
40+
41+
// Return from cache if available
42+
if (Cache::has($cacheKey)) {
43+
$cachedConfigs = Cache::get($cacheKey);
44+
foreach ($cachedConfigs as $key => $configs) {
45+
foreach ($configs as $alias => $items) {
46+
foreach ($items as $attr => $value) {
47+
Config::set("$alias.$attr", $value);
48+
}
49+
}
50+
}
51+
return;
52+
}
53+
3754
$options = [
3855
'config' => [
3956
'alias' => 'app',
@@ -47,13 +64,20 @@ public static function loadConfigFromDatabase(...$keys): void
4764
]
4865
];
4966

67+
$cachedConfigs = [];
68+
5069
foreach ($keys as $key) {
5170
// Determine the alias to use, defaulting to the key if not specified
5271
$option = $options[$key] ?? [];
5372
$alias = $option['alias'] ?? $key;
73+
$cachedConfigs[$key] = [];
74+
$cachedConfigs[$key][$alias] = [];
5475

5576
// Fetch settings from the database
5677
foreach (app_settings($key) as $attr => $value) {
78+
// Store for caching
79+
$cachedConfigs[$key][$alias][$attr] = $value;
80+
5781
// Set the configuration value in the application's config
5882
Config::set("$alias.$attr", $value);
5983

@@ -76,6 +100,9 @@ public static function loadConfigFromDatabase(...$keys): void
76100
}
77101
}
78102
}
103+
104+
// Store in cache
105+
Cache::put($cacheKey, $cachedConfigs, now()->addMinutes($cacheDuration));
79106
} catch (\Exception $e) {
80107
throw $e;
81108
}
@@ -84,33 +111,67 @@ public static function loadConfigFromDatabase(...$keys): void
84111
public static function loadPaymentMethodsConfig(): void
85112
{
86113
try {
114+
$cacheKey = 'payment_methods_config';
115+
$cacheDuration = 60; // Cache for 60 minutes
116+
117+
// Return from cache if available
118+
if (Cache::has($cacheKey)) {
119+
$paymentConfigs = Cache::get($cacheKey);
120+
121+
if (!empty($paymentConfigs['stripe'])) {
122+
config($paymentConfigs['stripe']);
123+
}
124+
125+
if (!empty($paymentConfigs['paypal'])) {
126+
config($paymentConfigs['paypal']);
127+
}
128+
129+
if (!empty($paymentConfigs['razorpay'])) {
130+
config($paymentConfigs['razorpay']);
131+
}
132+
133+
return;
134+
}
135+
136+
$paymentConfigs = [
137+
'stripe' => [],
138+
'paypal' => [],
139+
'razorpay' => []
140+
];
141+
87142
// Load cashier config from app payment methods table
88143
if ($stripe = PaymentMethod::stripe()) {
89-
config([
144+
$paymentConfigs['stripe'] = [
90145
'cashier.key' => $stripe->configs['API_KEY'],
91146
'cashier.secret' => $stripe->configs['API_SECRET'],
92147
'cashier.webhook.secret' => $stripe->configs['WEBHOOK_SECRET'],
93-
]);
148+
];
149+
config($paymentConfigs['stripe']);
94150
}
95151

96152
// Load paypal config from app payment methods table
97153
if ($paypal = PaymentMethod::paypal()) {
98154
$mode = $paypal->test_mode ? 'sandbox' : 'live';
99-
config([
155+
$paymentConfigs['paypal'] = [
100156
'paypal.mode' => $mode,
101157
"paypal.{$mode}.client_id" => $paypal->configs['CLIENT_ID'],
102158
"paypal.{$mode}.client_secret" => $paypal->configs['CLIENT_SECRET'],
103159
'paypal.notify_url' => $paypal->webhook,
104-
]);
160+
];
161+
config($paymentConfigs['paypal']);
105162
}
106163

107164
// Load razorpay config from app payment methods table
108165
if ($razorpay = PaymentMethod::razorpay()) {
109-
config([
166+
$paymentConfigs['razorpay'] = [
110167
"razorpay.key_id" => $razorpay->configs['API_KEY'],
111168
"razorpay.key_secret" => $razorpay->configs['API_SECRET'],
112-
]);
169+
];
170+
config($paymentConfigs['razorpay']);
113171
}
172+
173+
// Store in cache
174+
Cache::put($cacheKey, $paymentConfigs, now()->addMinutes($cacheDuration));
114175
} catch (\Exception $e) {
115176
throw $e;
116177
}

0 commit comments

Comments
 (0)