Bug fix in TranslationServiceProvider

This commit is contained in:
Jérémy Munsch 2023-02-17 15:34:15 +01:00
parent 6ffe20651a
commit ec00bfc061
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC

View file

@ -6,6 +6,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\Finder\SplFileInfo;
class TranslationServiceProvider extends ServiceProvider
{
@ -35,8 +36,8 @@ class TranslationServiceProvider extends ServiceProvider
*/
private function collectLocalesStrings(): Collection
{
return collect(File::allFiles(resource_path('lang/')))->flatMap(function ($file) {
if ($file->getRelativePath()) {
return collect(File::allFiles(resource_path('lang/')))->flatMap(function (SplFileInfo $file) {
if ($file->getRelativePath() and \strpos($file->getRelativePath(), 'vendor') !== 0) {
return [$file->getRelativePath() => ''];
}
})->keys();