Skip to content

Commit

Permalink
Give up and use the facade
Browse files Browse the repository at this point in the history
  • Loading branch information
lancepioch committed Jan 5, 2025
1 parent dd9d0d6 commit 86d3f2d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/Services/Helpers/LanguageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

namespace App\Services\Helpers;

use Illuminate\Container\Attributes\Storage;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\File;
use Locale;

class LanguageService
Expand All @@ -25,16 +24,14 @@ class LanguageService
'tr',
];

public function __construct(#[Storage('local')] protected Filesystem $filesystem) {}

public function isLanguageTranslated(string $countryCode = 'en'): bool
{
return in_array($countryCode, self::TRANSLATED_COMPLETELY, true);
}

public function getAvailableLanguages(string $path = 'lang'): array
{
return collect($this->filesystem->directories(base_path($path)))->mapWithKeys(function ($path) {
return collect(File::directories(base_path($path)))->mapWithKeys(function ($path) {
$code = basename($path);

return [$code => title_case(Locale::getDisplayName($code, $code))];
Expand Down

0 comments on commit 86d3f2d

Please sign in to comment.