Skip to content

Commit

Permalink
fix: lang folder
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangkhacphuc committed Mar 21, 2024
1 parent 96b44ee commit 8eb0a11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/ValidationServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
<?php

namespace Sphoton\Validation;

use Illuminate\Support\ServiceProvider;

class ValidationServiceProvider extends ServiceProvider
{
public function boot()
{
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'sphoton');
$this->loadTranslationsFrom(__DIR__.'/../lang', 'sphoton');
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../resources/lang' => $this->app->resourcePath('lang/vendor/sphoton'),
__DIR__.'/../lang' => $this->langPath('vendor/sphoton'),
]);
}
}
}

protected function langPath(mixed $path = ''): string
{
if (method_exists($this->app, 'langPath')) {
return $this->app->langPath($path);
}

return $this->app->resourcePath('lang/'.$path);
}
}
2 changes: 1 addition & 1 deletion tests/Unit/VietnameseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
$validator->passes();

$this->assertEquals('The name must be a Vietnamese string.', $validator->messages()->first());
});
});

0 comments on commit 8eb0a11

Please sign in to comment.