Skip to content

Commit 4c09df5

Browse files
committed
core helper static call issue fixed
1 parent 1f68bce commit 4c09df5

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/Core.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ public function packageExists(string $name, bool $throw = false): bool
105105
* @return mixed
106106
* @throws PackageNotInstalledException
107107
*/
108-
public static function launch(string $name = 'Core'): mixed
108+
public function launch(string $name = 'Core'): mixed
109109
{
110110
$name = \Illuminate\Support\Str::studly($name);
111111

112-
(new self())->packageExists($name, true);
112+
if (in_array($name, ['core', 'Core'])) {
113+
return $this;
114+
}
115+
116+
$this->packageExists($name, true);
113117

114118
$abstract = "\Fintech\\{$name}\\{$name}";
115119

src/Facades/Core.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @method static \Fintech\Core\Services\JobBatchService jobBatch()
1919
* @method static \Fintech\Core\Services\ClientErrorService clientError()
2020
* @method static \Fintech\Core\Services\MailService mail()
21+
* @method static \Fintech\Core\Core|mixed launch(string $name = 'core')
2122
* @method static \Fintech\Core\Services\MigrationService migration()
2223
* // Crud Service Method Point Do not Remove //
2324
*

src/helpers.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
use Fintech\Core\Core;
43
use Fintech\Core\Exceptions\PackageNotInstalledException;
54
use Fintech\Core\Supports\Currency;
65
use Illuminate\Contracts\Container\BindingResolutionException;
@@ -56,11 +55,11 @@ function entry_number($serial, string $country_code, string $type = ''): string
5655
$length = (int)config('fintech.core.entry_number_length', 20) - strlen($prefix);
5756

5857
return $prefix . str_pad(
59-
filter_var($serial, FILTER_SANITIZE_NUMBER_INT),
60-
$length,
61-
config('fintech.core.entry_number_fill', '0'),
62-
STR_PAD_LEFT
63-
);
58+
filter_var($serial, FILTER_SANITIZE_NUMBER_INT),
59+
$length,
60+
config('fintech.core.entry_number_fill', '0'),
61+
STR_PAD_LEFT
62+
);
6463
}
6564
}
6665

@@ -178,9 +177,9 @@ function singleton(string $abstract, $filters = null): mixed
178177
*/
179178
function next_purchase_number(string $countryIso3): string
180179
{
181-
$serial = Core::setting()->getValue('transaction', 'purchase_count', 1);
180+
$serial = \Fintech\Core\Facades\Core::setting()->getValue('transaction', 'purchase_count', 1);
182181

183-
Core::setting()->setValue('transaction', 'purchase_count', $serial + 1, 'integer');
182+
\Fintech\Core\Facades\Core::setting()->setValue('transaction', 'purchase_count', $serial + 1, 'integer');
184183

185184
return entry_number($serial, $countryIso3, \Fintech\Core\Enums\Transaction\OrderStatusConfig::Purchased->value);
186185
}
@@ -226,12 +225,12 @@ function throttle_key(): string
226225

227226
if (!function_exists('core')) {
228227
/**
229-
* @return Core
228+
* @return \Fintech\Core\Facades\Core
230229
* @throws PackageNotInstalledException|BindingResolutionException
231230
*/
232-
function core(): Core
231+
function core(): \Fintech\Core\Facades\Core
233232
{
234-
return Core::launch();
233+
return \Fintech\Core\Facades\Core::launch();
235234
}
236235
}
237236

0 commit comments

Comments
 (0)