Skip to content

Commit 773594b

Browse files
committed
ref: move publishes to boot method & update language publishing path
1 parent 029a6b9 commit 773594b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ php artisan vendor:publish --tag="persian-validation-config"
3737
```
3838

3939
If you want to use validations custom messages, you can publish language file.
40-
Run the below command on your terminal (the language file will be published to `lang/{locale}/persian-validation.php`. supported locales: `en`, `fa`):
40+
Run the below command on your terminal (the language file will be published to `lang/vendor/persianValidation/{locale}/persian-validation.php`. supported locales: `en`, `fa`):
4141

4242
```bash
4343
php artisan vendor:publish --tag="persian-validation-lang"

src/PersianValidationServiceProvider.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ class PersianValidationServiceProvider extends ServiceProvider
4040
*/
4141
public function register(): void
4242
{
43-
if ($this->app->runningInConsole()) {
44-
$this->publishLangFiles();
45-
$this->publishConfigFile();
46-
}
47-
48-
$this->loadTranslationsFrom(__DIR__ . '/../lang/', Enum::NAMESPACE);
4943
$this->mergeConfigFrom(__DIR__ . '/../config/' . Enum::FILE_NAME . '.php', Enum::FILE_NAME);
5044
}
5145

@@ -56,6 +50,13 @@ public function register(): void
5650
*/
5751
public function boot(): void
5852
{
53+
if ($this->app->runningInConsole()) {
54+
$this->publishLangFiles();
55+
$this->publishConfigFile();
56+
}
57+
58+
$this->loadTranslationsFrom(__DIR__ . '/../lang/', Enum::NAMESPACE);
59+
5960
// Register rules in container
6061
if (config(Enum::FILE_NAME . '.register_rules', true)) {
6162
$this->registerRules();
@@ -110,7 +111,7 @@ protected function publishConfigFile(): void
110111
protected function publishLangFiles(): void
111112
{
112113
$this->publishes([
113-
__DIR__ . '/../lang' => lang_path(),
114+
__DIR__ . '/../lang' => lang_path('vendor/' . Enum::NAMESPACE),
114115
], Enum::FILE_NAME . '-lang');
115116
}
116117
}

0 commit comments

Comments
 (0)