Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 077cc13

Browse files
Release version 1.0.2
1 parent 146761c commit 077cc13

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Tất cả lịch sử tiến trình phát triển thư viện
44

5+
# 1.0.2
6+
7+
- Cải thiện performance thông qua lazy load service provider.
8+
59
# 1.0.1
610

711
- Hổ trợ đa ngôn ngữ mặc định.

‎src/ServiceProvider.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
use PHPViet\Laravel\Validation\Rules\IpVN;
1313
use PHPViet\Laravel\Validation\Rules\MobileVN;
1414
use PHPViet\Laravel\Validation\Rules\LandLineVN;
15+
use Illuminate\Contracts\Support\DeferrableProvider;
1516
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
1617

1718
/**
1819
* @author Vuong Minh <vuongxuongminh@gmail.com>
1920
* @since 1.0.0
2021
*/
21-
class ServiceProvider extends BaseServiceProvider
22+
class ServiceProvider extends BaseServiceProviderimplements DeferrableProvider
2223
{
2324
public function boot(): void
2425
{
@@ -29,17 +30,15 @@ public function boot(): void
2930
protected function loadTrans(): void
3031
{
3132
$this->publishes([
32-
__DIR__.'/../resources/lang' => resource_path('lang/vendor/phpVietValidation'),
33+
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/phpVietValidation'),
3334
]);
34-
$this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'phpVietValidation');
35+
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang/', 'phpVietValidation');
3536
}
3637

3738
protected function loadExt(): void
3839
{
39-
if (isset($this->app['validator'])) {
40-
foreach ($this->getCallableRules() as $name => $rule) {
41-
$this->app['validator']->extend($name, $rule, $rule->message());
42-
}
40+
foreach ($this->getCallableRules() as $name => $rule) {
41+
$this->app['validator']->extend($name, $rule, $rule->message());
4342
}
4443
}
4544

@@ -54,4 +53,10 @@ protected function getCallableRules(): array
5453
'ipv6_vn' => $this->app->make(IpVN::class, [IpVN::IPV6]),
5554
];
5655
}
56+
57+
public function provides(): array
58+
{
59+
return ['validator'];
60+
}
61+
5762
}

‎tests/IdVNTest.php renamed to ‎tests/Rules/IdVNTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
* @license [MIT](https://opensource.org/licenses/MIT)
77
*/
88

9-
namespace PHPViet\Laravel\Validation\Tests;
9+
namespace PHPViet\Laravel\Validation\Tests\Rules;
1010

1111
use Illuminate\Support\Facades\Lang;
1212
use PHPViet\Laravel\Validation\Rules\IdVN;
13+
use PHPViet\Laravel\Validation\Tests\TestCase;
1314

1415
/**
1516
* @author Vuong Minh <vuongxuongminh@gmail.com>

‎tests/IpVNTest.php renamed to ‎tests/Rules/IpVNTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
* @license [MIT](https://opensource.org/licenses/MIT)
77
*/
88

9-
namespace PHPViet\Laravel\Validation\Tests;
9+
namespace PHPViet\Laravel\Validation\Tests\Rules;
1010

1111
use Illuminate\Support\Facades\Lang;
1212
use PHPViet\Laravel\Validation\Rules\IpVN;
13+
use PHPViet\Laravel\Validation\Tests\TestCase;
1314

1415
/**
1516
* @author Vuong Minh <vuongxuongminh@gmail.com>

‎tests/LandLineVNTest.php renamed to ‎tests/Rules/LandLineVNTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
* @license [MIT](https://opensource.org/licenses/MIT)
77
*/
88

9-
namespace PHPViet\Laravel\Validation\Tests;
9+
namespace PHPViet\Laravel\Validation\Tests\Rules;
1010

1111
use Illuminate\Support\Facades\Lang;
12+
use PHPViet\Laravel\Validation\Tests\TestCase;
1213
use PHPViet\Laravel\Validation\Rules\LandLineVN;
1314

1415
/**

‎tests/MobileVNTest.php renamed to ‎tests/Rules/MobileVNTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
* @license [MIT](https://opensource.org/licenses/MIT)
77
*/
88

9-
namespace PHPViet\Laravel\Validation\Tests;
9+
namespace PHPViet\Laravel\Validation\Tests\Rules;
1010

1111
use Illuminate\Support\Facades\Lang;
1212
use PHPViet\Laravel\Validation\Rules\MobileVN;
13+
use PHPViet\Laravel\Validation\Tests\TestCase;
1314

1415
/**
1516
* @author Vuong Minh <vuongxuongminh@gmail.com>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /